From 6f8316fe8f8e0a0697af9a625004097ad59eadc9 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 11 Sep 2016 12:17:59 +0200 Subject: [PATCH] toObject should not mutate original objects (fix #3657) --- src/shared/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/util.js b/src/shared/util.js index 7deaef15..afdd9a1a 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -170,8 +170,8 @@ export function isPlainObject (obj: any): boolean { * Merge an Array of Objects into a single Object. */ export function toObject (arr: Array): Object { - const res = arr[0] || {} - for (let i = 1; i < arr.length; i++) { + const res = {} + for (let i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]) }