From 4f8f4db5dd529a18753150f1c4f4528fd0dab6b0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 16 Jun 2017 10:21:38 +0800 Subject: [PATCH] simplify source with rest params --- src/core/observer/array.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/core/observer/array.js b/src/core/observer/array.js index 37c7bd114c..0dea252e3c 100644 --- a/src/core/observer/array.js +++ b/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