Browse Source

function: simplify arguments

mightyplow 7 năm trước cách đây
mục cha
commit
82192efd0b
1 tập tin đã thay đổi với 2 bổ sung3 xóa
  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));