Skip to content

Commit

Permalink
feature(package) es6-promisify v6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jan 31, 2018
1 parent b31678a commit f5f3671
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions lib/zames.js
@@ -1,20 +1,22 @@
'use strict';

const promisify = require('es6-promisify');
const promisify = require('es6-promisify').promisify;
const currify = require('currify/legacy');

module.exports = (fn, ctx) => {
check(fn);
checkCount(fn.length);

const f = [
(a) => promisify(fn, ctx)(a),
(a, b) => promisify(fn, ctx)(a, b),
(a, b, c) => promisify(fn, ctx)(a, b, c),
const f = fn.bind(ctx);

const funcs = [
(a) => promisify(f, ctx)(a),
(a, b) => promisify(f, ctx)(a, b),
(a, b, c) => promisify(f, ctx)(a, b, c),
];

const count = fn.length - 2;
return currify(f[count]);
const count = f.length - 2;
return currify(funcs[count]);
};

function check(fn) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"currify": "^2.0.0",
"es6-promisify": "^5.0.0"
"es6-promisify": "^6.0.0"
},
"license": "MIT",
"devDependencies": {
Expand Down

0 comments on commit f5f3671

Please sign in to comment.