Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

optimization: remove use of arguments

  • Loading branch information...
commit 30f430f5d0326b91c6947fa92796187728df83b4 1 parent a11fbb3
@jkroso jkroso authored committed
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/sliced.js
View
16 lib/sliced.js
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.