Skip to content

Commit 6f8316f

Browse files
committed
toObject should not mutate original objects (fix #3657)
1 parent 673dec6 commit 6f8316f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shared/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export function isPlainObject (obj: any): boolean {
170170
* Merge an Array of Objects into a single Object.
171171
*/
172172
export function toObject (arr: Array<any>): Object {
173-
const res = arr[0] || {}
174-
for (let i = 1; i < arr.length; i++) {
173+
const res = {}
174+
for (let i = 0; i < arr.length; i++) {
175175
if (arr[i]) {
176176
extend(res, arr[i])
177177
}

0 commit comments

Comments
 (0)