Skip to content

Commit

Permalink
doc: clarify usage of util.promisify.custom
Browse files Browse the repository at this point in the history
PR-URL: #16134
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
shiya authored and jasnell committed Oct 13, 2017
1 parent 8d3e82f commit cc258af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc258af

Please sign in to comment.