Last active
December 21, 2015 15:30
-
-
Save Fishrock123/98c35a0c745cb59d7496 to your computer and use it in GitHub Desktop.
Please see: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments
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
// should do the same as | |
// var args = Array.prototype.slice.call(arguments) | |
// without leaking arguments | |
var i = arguments.length | |
var args = new Array(i) | |
while (i-- !== 0) args[i] = arguments[i] | |
// should do the same as | |
// var args = Array.prototype.slice.call(arguments, 3); | |
// without leaking arguments | |
var i = arguments.length - 3 | |
var args = [] | |
if (i > 0) { | |
args.length = i | |
while (i-- !==0) args[i] = arguments[i + 3] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment