Parcourir la source

function: simplify arguments

mightyplow il y a 7 ans
Parent
commit
82192efd0b
1 fichiers modifiés avec 2 ajouts et 3 suppressions
  1. 2 3
      lib/function.js

+ 2 - 3
lib/function.js

@@ -10,9 +10,8 @@ const argsToArray = fn => {
 };
 
 const curry = fn => {
-    return function curried () {
-        const that = this,
-            args = Array.prototype.slice.call(arguments);
+    return function curried (...args) {
+        const that = this;
 
         if (args.length < fn.length) {
             return curried.bind.apply(curried, [that].concat(args));