Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100884643
exactProp.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 3, 14:53
Size
825 B
Mime Type
text/x-java
Expires
Wed, Feb 5, 14:53 (2 d)
Engine
blob
Format
Raw Data
Handle
24049008
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
exactProp.js
View Options
import _extends from "@babel/runtime/helpers/esm/extends";
// 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.
const specialProperty = 'exact-prop: \u200b';
export default function exactProp(propTypes) {
if (process.env.NODE_ENV === 'production') {
return propTypes;
}
return _extends({}, propTypes, {
[specialProperty]: props => {
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
if (unsupportedProps.length > 0) {
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
}
return null;
}
});
}
Event Timeline
Log In to Comment