We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaf6b54 commit f2b476dCopy full SHA for f2b476d
src/core/observer/array.js
@@ -8,18 +8,20 @@ import { def } from '../util/index'
8
const arrayProto = Array.prototype
9
export const arrayMethods = Object.create(arrayProto)
10
11
-/**
12
- * Intercept mutating methods and emit events
13
- */
14
-;[
+const methodsToPatch = [
15
'push',
16
'pop',
17
'shift',
18
'unshift',
19
'splice',
20
'sort',
21
'reverse'
22
-].forEach(function (method) {
+]
+
+/**
+ * Intercept mutating methods and emit events
23
+ */
24
+methodsToPatch.forEach(function (method) {
25
// cache original method
26
const original = arrayProto[method]
27
def(arrayMethods, method, function mutator (...args) {
0 commit comments