UNPKG

semantic-ui-calendar-react

Version:
26 lines (22 loc) 973 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * Returns an object consisting of props beyond the scope of the Component. * Useful for getting and spreading unknown props from the user. * @param {function} Component A function or ReactClass. * @param {object} props A ReactElement props object * @returns {{}} A shallow copy of the prop object */ var getUnhandledProps = function getUnhandledProps(Component, props) { // Note that `handledProps` are generated automatically during build with `babel-plugin-transform-react-handled-props` var _Component$handledPro = Component.handledProps, handledProps = _Component$handledPro === undefined ? [] : _Component$handledPro; return Object.keys(props).reduce(function (acc, propKey) { if (propKey === 'childKey') return acc; if (handledProps.indexOf(propKey) === -1) acc[propKey] = props[propKey]; return acc; }, {}); }; exports.default = getUnhandledProps;