![JAR search and dependency download from the Maven repository](/logo.png)
package.lib.utils.mergeByName.js.flow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Tooltip and Popover Positioning Engine
// @flow
import type { Modifier } from '../types';
export default function mergeByName(
modifiers: Array<$Shape>>
): Array<$Shape>> {
const merged = modifiers.reduce((merged, current) => {
const existing = merged[current.name];
merged[current.name] = existing
? {
...existing,
...current,
options: { ...existing.options, ...current.options },
data: { ...existing.data, ...current.data },
}
: current;
return merged;
}, {});
// IE11 does not support Object.values
return Object.keys(merged).map(key => merged[key]);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy