Просмотр исходного кода

simplify source with rest params

Evan You 9 лет назад
Родитель
Сommit
4f8f4db5dd
1 измененных файлов с 1 добавлено и 8 удалено
  1. 1 8
      src/core/observer/array.js

+ 1 - 8
src/core/observer/array.js

@@ -23,14 +23,7 @@ export const arrayMethods = Object.create(arrayProto)
 .forEach(function (method) {
   // cache original method
   const original = arrayProto[method]
-  def(arrayMethods, method, function mutator () {
-    // avoid leaking arguments:
-    // http://jsperf.com/closure-with-arguments
-    let i = arguments.length
-    const args = new Array(i)
-    while (i--) {
-      args[i] = arguments[i]
-    }
+  def(arrayMethods, method, function mutator (...args) {
     const result = original.apply(this, args)
     const ob = this.__ob__
     let inserted