|
@@ -24,7 +24,7 @@ const curry = fn => {
|
|
|
|
|
|
const combine = argsToArray(fns => fns.reverse().reduce((fnc, fn) => val => fnc(fn(val))));
|
|
const combine = argsToArray(fns => fns.reverse().reduce((fnc, fn) => val => fnc(fn(val))));
|
|
|
|
|
|
-const promisify = fn => () => {
|
|
|
|
|
|
+const promisify = (fn, context = null) => () => {
|
|
// copy passed arguments to a new array
|
|
// copy passed arguments to a new array
|
|
const args = toArray(arguments);
|
|
const args = toArray(arguments);
|
|
|
|
|
|
@@ -39,7 +39,7 @@ const promisify = fn => () => {
|
|
});
|
|
});
|
|
|
|
|
|
// call the original function with our callback flavoured arguments
|
|
// call the original function with our callback flavoured arguments
|
|
- fn.apply(null, args);
|
|
|
|
|
|
+ fn.apply(context, args);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|