![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@decisiv/prop-types
Advanced tools
This package exports a variety of useful proptype validators for use within the Key Design System.
yarn add @decisiv/prop-types
forbiddenIf
Used inside of proptypes declaration object as the validator itself. Takes two arguments: a proptypes validator and a conditional. Allows you to conditionally forbid a prop value based on other props/ logic. The prop is forbidden if the condition returns true.
Example use:
import { forbiddenIf } from '@decisiv/prop-types';
const propTypes = {
text: forbiddenIf(PropTypes.string, (props) => !!props.icon),
icon: forbiddenIf(PropTypes.string, (props) => !!props.text),
};
YourComponent.propTypes = propTypes;
requireAllOrNoneOf
Takes an object containing valid proptypes. Will error if some props are defined, but not if either all or none of the props are defined.
Example use:
import { requireAllOrNoneOf } from '@decisiv/prop-types';
const propTypes = {
action: PropTypes.string,
actionIcon: PropTypes.string,
};
requireAllOfNoneOf(propTypes);
YourComponent.propTypes = propTypes;
requireAtLeastOneOf
Takes an object containing valid proptypes. Will error if none of the props are defined, but not if one or more are defined.
Example use:
import { requireAtLeastOneOf } from '@decisiv/prop-types';
const propTypes = {
text: PropTypes.string,
icon: PropTypes.string,
};
requireAtLeastOneOf(propTypes);
YourComponent.propTypes = propTypes;
requireIfDefined
Used to validate that one or more props are required if a different prop is defined.
Example use:
import { requireIfDefined } from '@decisiv/prop-types';
const propTypes = {
text: PropTypes.string,
icon: PropTypes.string,
};
requireIfDefined('foo', propTypes);
YourComponent.propTypes = propTypes;
requireIf
Used inside of proptypes declaration object as the validator itself. Takes two arguments: a proptypes validator and a function. Allows you to conditionally require a prop value based on other props/ logic. The prop is required if the condition return true.
Example use:
import { requireIf } from '@decisiv/prop-types';
const propTypes = {
text: requireIf(PropTypes.string, (props) => !props.icon),
icon: requireIf(PropTypes.string, (props) => !props.text),
};
YourComponent.propTypes = propTypes;
FAQs
Decisiv's custom React PropType validators.
The npm package @decisiv/prop-types receives a total of 0 weekly downloads. As such, @decisiv/prop-types popularity was classified as not popular.
We found that @decisiv/prop-types demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.