Skip to content

Commit

Permalink
doc: clarify usage of util.promisify.custom
Browse files Browse the repository at this point in the history
  • Loading branch information
shiya committed Oct 13, 2017
1 parent 4faa231 commit 38874bc
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, if you have a pattern that takes in `(foo, onSuccessCallback, onErrorCallback)`, you can do:

```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 38874bc

Please sign in to comment.