@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
20 lines (19 loc) • 650 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.assignPropsWithContext = assignPropsWithContext;
var _extendPropsWithContext = require("./extendPropsWithContext.js");
function assignPropsWithContext(props, ...contexts) {
props = Object.isFrozen(props) ? {
...props
} : props;
const context = (0, _extendPropsWithContext.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