Skip to content

Instantly share code, notes, and snippets.

@szmeku
Created April 17, 2018 18:58
Show Gist options
  • Select an option

  • Save szmeku/baf27d74fbbfd4f3d6c54750f5a9a746 to your computer and use it in GitHub Desktop.

Select an option

Save szmeku/baf27d74fbbfd4f3d6c54750f5a9a746 to your computer and use it in GitHub Desktop.
const promisifyFunction = function (func) {
return function () {
let that = this,
// IE10 fix (in IE10 Promise.all(arguments) neither Array.from(arguments) doesn't work
args = Array.from ? Array.from(arguments) : _.map(_.identity, arguments);
return Promise.all(args).then(function (resolvedArguments) {
return func.apply(that, resolvedArguments);
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment