Skip to content

Commit e3183d6

Browse files
committed
fix merge object
1 parent a057dc0 commit e3183d6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/util.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,20 @@ export function createAction (action, store) {
2020
* Merge an array of objects into one.
2121
*
2222
* @param {Array<Object>} arr
23-
* @param {Boolean} allowDuplicate
2423
* @return {Object}
2524
*/
2625

27-
export function mergeObjects (arr, allowDuplicate) {
26+
export function mergeObjects (arr) {
2827
return arr.reduce((prev, obj) => {
2928
Object.keys(obj).forEach(key => {
3029
const existing = prev[key]
3130
if (existing) {
3231
// allow multiple mutation objects to contain duplicate
3332
// handlers for the same mutation type
34-
if (allowDuplicate) {
35-
if (Array.isArray(existing)) {
36-
existing.push(obj[key])
37-
} else {
38-
prev[key] = [prev[key], obj[key]]
39-
}
33+
if (Array.isArray(existing)) {
34+
existing.push(obj[key])
4035
} else {
41-
console.warn(`[vuex] Duplicate action: ${ key }`)
36+
prev[key] = [prev[key], obj[key]]
4237
}
4338
} else {
4439
prev[key] = obj[key]

0 commit comments

Comments
 (0)