doc: clarify usage of util.promisify.custom

PR-URL: https://github.com/nodejs/node/pull/16134
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Shiya Luo 2017-10-09 18:46:14 -07:00 committed by James M Snell
parent 8d3e82fd6c
commit cc258af0e4

View File

@ -525,6 +525,16 @@ console.log(promisified === doSomething[util.promisify.custom]);
This can be useful for cases where the original function does not follow the
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(foo, resolve, reject);
});
};
```
### util.promisify.custom
<!-- YAML
added: v8.0.0