Gathering detailed insights and metrics for parse-prop-types
Gathering detailed insights and metrics for parse-prop-types
Gathering detailed insights and metrics for parse-prop-types
Gathering detailed insights and metrics for parse-prop-types
extract-react-types
Parse prop-types from react components using typescript or flow
@luomus/parse-prop-types
Parses React prop-types into a readable object
@bebraw/extract-react-types
Parse prop-types from react components using typescript or flow
@uber-web-ui/extract-react-types
Parse prop-types from react components using typescript or flow
npm install parse-prop-types
Typescript
Module System
Min. Node Version
Node Version
NPM Version
96.8
Supply Chain
94.5
Quality
74.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
69 Stars
30 Commits
5 Forks
1 Watchers
15 Branches
2 Contributors
Updated on Apr 27, 2024
Latest Version
0.3.0
Package Id
parse-prop-types@0.3.0
Size
3.80 kB
NPM Version
6.1.0
Node Version
8.11.2
Published on
Jul 10, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
21
Parses React prop-types
into a readable object at runtime.
$ npm install --save parse-prop-types
1import React from 'react' 2import PropTypes from 'prop-types' 3import parsePropTypes from 'parse-prop-types' 4 5const MyComponent = ({ name, show }) => ( 6 show ? <div>{name}</div> : null 7) 8 9MyComponent.propTypes = { 10 name: PropTypes.string, 11 show: PropTypes.oneOfType([PropTypes.bool, propTypes.string]).isRequired, 12} 13 14MyComponent.defaultProps = { 15 name: 'Haz', 16} 17 18parsePropTypes(MyComponent)
The returned object is compatible with react-docgen
:
1{ 2 name: { 3 type: { 4 name: 'string', 5 }, 6 required: false, 7 defaultValue: { 8 value: 'Haz', 9 }, 10 }, 11 show: { 12 type: { 13 name: 'oneOfType', 14 value: [ 15 { name: 'bool' }, 16 { name: 'string' }, 17 ], 18 }, 19 required: true, 20 }, 21}
react-docgen
?react-docgen
reads file contents in order to find prop types definitions. It has some limitations, such as not allowing computed prop types and, in several situations, not being able to parse file contents correctly.
parse-prop-types
, on the other hand, doesn't deal with file contents. Instead, it parses prop types at runtime by receiving the component object itself.
Parameters
$0
any
$0.propTypes
(optional, default {}
)$0.defaultProps
(optional, default {}
)Returns Object
MIT © Diego Haz
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
72 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More