Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,24 @@
// @flow
// This module is based on https://github.com/airbnb/prop-types-exact repository.
// However, in order to reduce the number of dependencies and to remove some extra safe checks
// the module was forked.
export const specialProperty = 'exact-prop: \u200b';
export default function exactProp(propTypes: Object, componentNameInError: string) {
return {
...propTypes,
// eslint-disable-next-line prefer-arrow-callback
[specialProperty]: props => {
const unknownProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
if (unknownProps.length > 0) {
return new TypeError(
`${componentNameInError}: unknown props found: ${unknownProps.join(
', ',
)}. Please remove the unknown properties.`,
);
}
return null;
},
};
}