This file contains 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
// Micro-benchmark to answer the question in https://twitter.com/thejameskyle/status/905403367949647874 | |
if (typeof console === 'undefined') console = {log:print}; | |
var closuresOriginal = (function() { | |
const outer = a => { | |
const inner = b => a + b; | |
return inner(2); | |
}; |
This file contains 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
function applyFunctionsRest(functions, ...args) { | |
for (var i = 0, l = functions.length; i < l; ++i) { | |
functions[i].apply(this, args); | |
} | |
} | |
var safeApply = Function.prototype.call.bind(Function.prototype.apply); | |
function safeApplyFunctionsRest(functions, ...args) { | |
for (var i = 0, l = functions.length; i < l; ++i) { |