Created
April 17, 2018 18:58
-
-
Save szmeku/baf27d74fbbfd4f3d6c54750f5a9a746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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