package.dist.esm.utils.split-props.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
Responsive and accessible React UI components built with React and Emotion
The newest version!
"use strict";
const splitProps = (props, keys) => {
const descriptors = Object.getOwnPropertyDescriptors(props);
const dKeys = Object.keys(descriptors);
const split = (k) => {
const clone = {};
for (let i = 0; i < k.length; i++) {
const key = k[i];
if (descriptors[key]) {
Object.defineProperty(clone, key, descriptors[key]);
delete descriptors[key];
}
}
return clone;
};
const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
return [keys].map(fn).concat(split(dKeys));
};
const createSplitProps = (keys) => {
return function split(props) {
return splitProps(props, keys);
};
};
export { createSplitProps, splitProps };
© 2015 - 2025 Weber Informatics LLC | Privacy Policy