Skip to content

Commit

Permalink
fix code style, set node version to 4 and generate readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Jan 16, 2017
1 parent ea35bb9 commit 1674558
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
[![build status](https://img.shields.io/travis/bojand/promisify-call/master.svg?style=flat-square)](https://travis-ci.org/bojand/promisify-call)

Promisify a function call so users can call a function with a callback or get a promise.
* **2.0** works only with native `Promise` so requires Node >= 6.9.
* **2.0** works only with native `Promise` so requires Node >= 4.0.
* **1.0** uses [Bluebird](www.bluebirdjs.com) and should work with older Node.js

## Installation
@@ -38,7 +38,7 @@ console.log(res); // FOO

<a name="promisifyCall"></a>

### promisifyCall(ctx, fn, ...args) ⇒ <code>undefined</code> &#124; <code>\*</code> &#124; <code>Promise</code>
### promisifyCall(ctx, fn, args) ⇒ <code>undefined</code> &#124; <code>\*</code> &#124; <code>Promise</code>
Promisifies the call to <code>fn</code> if appropriate given the arguments.
Calls the function <code>fn</code> either using callback style if last argument is a function.
If last argument is not a function, <code>fn</code> is called returning a promise.
@@ -51,7 +51,7 @@ This lets you create API that can be called in either fashions.
| --- | --- | --- |
| ctx | <code>Object</code> | context / this |
| fn | <code>function</code> | The function to call |
| ...args | <code>arguments</code> | Arguments |
| args | <code>arguments</code> | Arguments |

## License

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ const wc = require('with-callback')
function promisifyCall (ctx, fn) {
const args = []
args.push.apply(args, arguments)
args.splice(0,2)
args.splice(0, 2)
// check if last (callback) argument is being pased in explicitly
// as it might be undefined or null, in which case we'll replace it
const same = fn.length && args.length === fn.length
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
"standard": "^8.5.0"
},
"engines": {
"node": ">=4.3.2"
"node": ">=4.0"
},
"ava": {
"files": [
2 changes: 1 addition & 1 deletion readme.hbs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
[![build status](https://img.shields.io/travis/bojand/promisify-call/master.svg?style=flat-square)](https://travis-ci.org/bojand/promisify-call)

Promisify a function call so users can call a function with a callback or get a promise.
* **2.0** works only with native `Promise` so requires Node >= 4.3.2.
* **2.0** works only with native `Promise` so requires Node >= 4.0.
* **1.0** uses [Bluebird](www.bluebirdjs.com) and should work with older Node.js

## Installation

0 comments on commit 1674558

Please sign in to comment.