merge.mjs 639 B

1234567891011121314151617181920
  1. import { defaultExtendedIconProps, defaultIconTransformations } from './defaults.mjs';
  2. import { mergeIconTransformations } from './transformations.mjs';
  3. function mergeIconData(parent, child) {
  4. const result = mergeIconTransformations(parent, child);
  5. for (const key in defaultExtendedIconProps) {
  6. if (key in defaultIconTransformations) {
  7. if (key in parent && !(key in result)) {
  8. result[key] = defaultIconTransformations[key];
  9. }
  10. } else if (key in child) {
  11. result[key] = child[key];
  12. } else if (key in parent) {
  13. result[key] = parent[key];
  14. }
  15. }
  16. return result;
  17. }
  18. export { mergeIconData };