UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

25 lines (21 loc) 746 B
/** * Returns an object consisting of props beyond the scope of the Component. * Useful for getting and spreading unknown props from the user. * @param {object} propTypes * @param {object} props A ReactElement props object * @returns {{}} A shallow copy of the prop object */ // fix unable to get propTypes after gatsby is compiled var getUnhandledProps = function getUnhandledProps(propTypeKeys, props) { return Object.keys(props).reduce(function (acc, prop) { if (prop === 'childKey') { return acc; } if (propTypeKeys.length > 0 && propTypeKeys.indexOf(prop) === -1) { acc[prop] = props[prop]; } return acc; }, {}); }; export default getUnhandledProps; //# sourceMappingURL=getUnhandledProps.js.map