Skip to content

Commit

Permalink
doc: use arrow functions in util.md sample code
Browse files Browse the repository at this point in the history
PR-URL: #17459
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
mithunsasidharan authored and MylesBorins committed Dec 12, 2017
1 parent 8c32b4a commit 7e38821
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ it is marked as deprecated.
```js
const util = require('util');

exports.puts = util.deprecate(function() {
for (let i = 0, len = arguments.length; i < len; ++i) {
process.stdout.write(arguments[i] + '\n');
}
}, 'util.puts: Use console.log instead');
exports.obsoleteFunction = util.deprecate(() => {
// Do something here.
}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');
```

When called, `util.deprecate()` will return a function that will emit a
Expand Down Expand Up @@ -1023,7 +1021,7 @@ util.isObject(null);
// Returns: false
util.isObject({});
// Returns: true
util.isObject(function() {});
util.isObject(() => {});
// Returns: false
```

Expand Down Expand Up @@ -1055,7 +1053,7 @@ util.isPrimitive(undefined);
// Returns: true
util.isPrimitive({});
// Returns: false
util.isPrimitive(function() {});
util.isPrimitive(() => {});
// Returns: false
util.isPrimitive(/^$/);
// Returns: false
Expand Down

0 comments on commit 7e38821

Please sign in to comment.