Repository URL to install this package:
|
Version:
1.2.13 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.toUnknownProps = exports.toRemainingProps = exports.passThroughProps = void 0;
var _chainAbleBoost = require("chain-able-boost");
/**
* @alias unknownProps
* @alias remainingProps
* @name passThroughProps
*
* @param {Object} types
* @param {React.Props} props
* @return {React.Props} props that were not in the proptypes to pass through
*/
function _passThroughProps(types, props) {
// list
const supportedPropsList = Object.keys(types.types);
const currentPropsList = Object.keys(props); // filter
const isUnsupported = propName => !supportedPropsList.includes(propName);
const remaining = currentPropsList.filter(isUnsupported); // define
let propsNotInSupportedList = {};
remaining.forEach(propName => {
propsNotInSupportedList[propName] = props[propName];
}); // filter / alias
// propsNotInSupportedList = autofixProps(propsNotInSupportedList, this.props)
return propsNotInSupportedList;
}
const passThroughProps = (0, _chainAbleBoost.curry)(2, _passThroughProps);
exports.toUnknownProps = exports.toRemainingProps = exports.passThroughProps = passThroughProps;
var _default = passThroughProps;
exports.default = _default;