main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
524 bytes
|
Line | |
---|
1 | export default function mergeByName(modifiers) {
|
---|
2 | var merged = modifiers.reduce(function (merged, current) {
|
---|
3 | var existing = merged[current.name];
|
---|
4 | merged[current.name] = existing ? Object.assign({}, existing, current, {
|
---|
5 | options: Object.assign({}, existing.options, current.options),
|
---|
6 | data: Object.assign({}, existing.data, current.data)
|
---|
7 | }) : current;
|
---|
8 | return merged;
|
---|
9 | }, {}); // IE11 does not support Object.values
|
---|
10 |
|
---|
11 | return Object.keys(merged).map(function (key) {
|
---|
12 | return merged[key];
|
---|
13 | });
|
---|
14 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.