
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
prop-types-plus
Advanced tools
Another library of custom PropType validators. It is greatly inspired by [`airbnb/prop-types`](https://github.com/airbnb/prop-types), which probably already offers the same custom types and more. I just wanted to create my own. 🙃
Another library of custom PropType validators. It is greatly inspired by airbnb/prop-types, which probably already offers the same custom types and more. I just wanted to create my own. 🙃
yarn add prop-types-plus
[!NOTE] Since PropTypes are only useful for developement, when
NODE_ENVis set toproductionmock functions are exported instead of the real validators.
arrayOfShapeValidates the type of the entries in an array in the given order.
arrayOfShape(shape: PropTypes[])
import { string, number } from "prop-type";
import { arrayOfShape } from "prop-types-plus";
const propTypes = {
foo: arrayOfShape([string, number.isRequired]),
fooRequired: arrayOfShape([string, number.isRequired]).isRequired
};
requiredIfTests whether a prop is required based on a given condition.
requiredIf(
type: PropTypes,
condition: (props: object) => boolean,
errorMessage?: string
)
import { string } from "prop-type";
import { requiredIf } from "prop-types-plus";
const propTypes = {
foo: requiredIf(
string,
(props) => props.bar
"The prop `foo` is required when there is `bar`."
)
};
stringOfShapeTests whether a string match the given regex.
stringOfShape(regex: RegExp)
import { stringOfShape } from "prop-types-plus";
const propTypes = {
foo: stringOfShape(/^#.+/),
fooRequired: stringOfShape(/^#.+/).isRequired
};
unnecessaryWhenTests whether a prop is unnecessary based on a given condition.
unnecessaryWhen(
type: PropTypes,
condition: (props: object) => boolean,
errorMessage?: string
)
import { string } from "prop-type";
import { unnecessaryWhen } from "prop-types-plus";
const propTypes = {
foo: requiredIf(
string,
(props) => props.bar
"The prop `foo` is unnecessary when there is `bar`."
)
};
FAQs
Another library of custom PropType validators. It is greatly inspired by [`airbnb/prop-types`](https://github.com/airbnb/prop-types), which probably already offers the same custom types and more. I just wanted to create my own. 🙃
We found that prop-types-plus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.