@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
14 lines • 482 B
JavaScript
import { reduceContext } from "./extendPropsWithContext.js";
export function assignPropsWithContext(props, ...contexts) {
props = Object.isFrozen(props) ? {
...props
} : props;
const context = reduceContext(contexts);
return Object.entries(context).reduce((acc, [key, value]) => {
if (!(props && Object.prototype.hasOwnProperty.call(props, key))) {
acc[key] = value;
}
return acc;
}, props || {});
}
//# sourceMappingURL=assignPropsWithContext.js.map