Gathering detailed insights and metrics for @luomus/parse-prop-types
Gathering detailed insights and metrics for @luomus/parse-prop-types
Gathering detailed insights and metrics for @luomus/parse-prop-types
Gathering detailed insights and metrics for @luomus/parse-prop-types
Parses React prop-types into a readable object
npm install @luomus/parse-prop-types
Typescript
Module System
Min. Node Version
Node Version
NPM Version
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
@luomus/parse-prop-types@0.3.0
Unpacked Size
9.85 kB
Size
4.01 kB
File Count
6
NPM Version
6.14.18
Node Version
14.21.3
Published on
Nov 03, 2023
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}
IMPORTANT: To avoid issues reading any component's propTypes, it is recommendable importing this package before defining your components' propTypes or before import any third-party component. Import this package in your entry point file could be a great option.
// index.js (entry point file)
import "parse-prop-types";
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