Kaynağa Gözat

simplify source with rest params

Evan You 9 yıl önce
ebeveyn
işleme
4f8f4db5dd
1 değiştirilmiş dosya ile 1 ekleme ve 8 silme
  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