From a79d9f6aeaf9087edcedaa7db8728fe4009f576c Mon Sep 17 00:00:00 2001 From: Leko Date: Sun, 26 Nov 2017 17:05:16 +0900 Subject: [PATCH] doc: replace function with arrow function PR-URL: https://github.com/nodejs/node/pull/17304 Reviewed-By: Joyee Cheung Reviewed-By: Ron Korving Reviewed-By: Yuta Hiroto Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Jon Moss Reviewed-By: James M Snell --- doc/api/util.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 3ba8cade5439e0..f116c840e315cc 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -419,7 +419,7 @@ but may return a value of any type that will be formatted accordingly by const util = require('util'); const obj = { foo: 'this will not show up in the inspect() output' }; -obj[util.inspect.custom] = function(depth) { +obj[util.inspect.custom] = (depth) => { return { bar: 'baz' }; }; @@ -529,7 +529,7 @@ function doSomething(foo, callback) { // ... } -doSomething[util.promisify.custom] = function(foo) { +doSomething[util.promisify.custom] = (foo) => { return getPromiseSomehow(); }; @@ -544,8 +544,8 @@ standard format of taking an error-first callback as the last argument. For example, with a function that takes in `(foo, onSuccessCallback, onErrorCallback)`: ```js -doSomething[util.promisify.custom] = function(foo) { - return new Promise(function(resolve, reject) { +doSomething[util.promisify.custom] = (foo) => { + return new Promise((resolve, reject) => { doSomething(foo, resolve, reject); }); };