Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99903699
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, Jan 27, 05:16
Size
825 B
Mime Type
text/x-java
Expires
Wed, Jan 29, 05:16 (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
23846575
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