Skip to content

Commit

Permalink
feat: exports thenify
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Jan 10, 2015
1 parent f6e3500 commit bf3fcd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ fs.readFile(__filename).then(function (buffer) {

## API

### var obj = thenify(source, [obj], [methods])
### var obj = thenifyAll(source, [obj], [methods])

Promisifies all the selected functions in an object.

- `source` - the source object for the async functions
- `obj` - the destination to set all the promisified methods
- `methods` - an array of method names of `source`

### var obj = thenify.withCallback(source, [obj], [methods])
### var obj = thenifyAll.withCallback(source, [obj], [methods])

Promisifies all the selected functions in an object and backward compatible with callback.

- `source` - the source object for the async functions
- `obj` - the destination to set all the promisified methods
- `methods` - an array of method names of `source`

### thenifyAll.thenify

Exports [thenify](https://github.com/thenables/thenify) this package uses.

[gitter-image]: https://badges.gitter.im/thenables/thenify-all.png
[gitter-url]: https://gitter.im/thenables/thenify-all
[npm-image]: https://img.shields.io/npm/v/thenify-all.svg?style=flat-square
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
var thenify = require('thenify')

module.exports = thenifyAll
thenifyAll.withCallback = withCallback
thenifyAll.thenify = thenify

/**
* Promisifies all the selected functions in an object.
Expand All @@ -27,7 +29,7 @@ function thenifyAll(source, destination, methods) {
* @api public
*/

thenifyAll.withCallback= function(source, destination, methods) {
function withCallback(source, destination, methods) {
return promisifyAll(source, destination, methods, thenify.withCallback)
}

Expand Down

0 comments on commit bf3fcd0

Please sign in to comment.