All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.esm.utils.mergeByName.js Maven / Gradle / Ivy

There is a newer version: 2.11.8
Show newest version
export default function mergeByName(modifiers) {
  var merged = modifiers.reduce(function (merged, current) {
    var existing = merged[current.name];
    merged[current.name] = existing ? Object.assign({}, existing, current, {
      options: Object.assign({}, existing.options, current.options),
      data: Object.assign({}, existing.data, current.data)
    }) : current;
    return merged;
  }, {}); // IE11 does not support Object.values

  return Object.keys(merged).map(function (key) {
    return merged[key];
  });
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy