Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getProps(node, options) {
const props = omitBy(Object.assign({}, propsOfNode(node)), (val, key) => {
if (key === 'children' || val === undefined) {
return true;
}
if (
options.ignoreDefaultProps === true &&
typeof node.type === 'function' &&
node.type.defaultProps &&
key in node.type.defaultProps &&
node.type.defaultProps[key] === val
) {
return true;
}
});
if (!isNil(node.key) && options.noKey !== true) {
function getProps(node, options) {
const props = omitBy(
{
...propsOfNode(node),
},
(val, key) => {
return key === 'children' || val === undefined;
},
);
if (!isNil(node.key) && options.noKey !== true) {
props.key = node.key;
}
return props;
}