@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
34 lines (33 loc) • 2.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.omitDataValueReadProps = omitDataValueReadProps;
exports.omitDataValueReadWriteProps = omitDataValueReadWriteProps;
exports.omitDataValueWriteProps = omitDataValueWriteProps;
exports.pickDataValueReadProps = pickDataValueReadProps;
exports.pickDataValueReadWriteProps = pickDataValueReadWriteProps;
exports.pickDataValueWriteProps = pickDataValueWriteProps;
var _includes = _interopRequireDefault(require("core-js-pure/stable/instance/includes.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const dataValueReadProps = ['path', 'itemPath', 'value'];
function pickDataValueReadProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => (0, _includes.default)(dataValueReadProps).call(dataValueReadProps, key)));
}
function omitDataValueReadProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !(0, _includes.default)(dataValueReadProps).call(dataValueReadProps, key)));
}
const dataValueWriteProps = ['emptyValue', 'onFocus', 'onBlur', 'onChange'];
function pickDataValueWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => (0, _includes.default)(dataValueWriteProps).call(dataValueWriteProps, key)));
}
function omitDataValueWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !(0, _includes.default)(dataValueWriteProps).call(dataValueWriteProps, key)));
}
function pickDataValueReadWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => (0, _includes.default)(dataValueReadProps).call(dataValueReadProps, key) || (0, _includes.default)(dataValueWriteProps).call(dataValueWriteProps, key)));
}
function omitDataValueReadWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !(0, _includes.default)(dataValueReadProps).call(dataValueReadProps, key) && !(0, _includes.default)(dataValueWriteProps).call(dataValueWriteProps, key)));
}
//# sourceMappingURL=types.js.map