Permalink
Browse files

optimization: remove use of arguments

  • Loading branch information...
jkroso authored and aheckmann committed Feb 5, 2013
1 parent a11fbb3 commit 30f430f5d0326b91c6947fa92796187728df83b4
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/sliced.js
View
@@ -8,11 +8,7 @@
* @api public
*/
-module.exports = function () {
- var args = arguments[0];
- var slice = arguments[1];
- var sliceEnd = arguments[2];
-
+module.exports = function (args, slice, sliceEnd) {
var ret = [];
var len = args.length;
@@ -22,14 +18,14 @@ module.exports = function () {
? Math.max(0, slice + len)
: slice || 0;
- var end = 3 === arguments.length
- ? sliceEnd < 0
+ if (sliceEnd !== undefined) {
+ len = sliceEnd < 0
? sliceEnd + len
: sliceEnd
- : len;
+ }
- while (end-- > start) {
- ret[end - start] = args[end];
+ while (len-- > start) {
+ ret[len - start] = args[len];
}
return ret;

0 comments on commit 30f430f

Please sign in to comment.