Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import elementType
from 'prop-types-extra/lib/elementType';
import createChainableTypeChecker
from 'prop-types-extra/lib/utils/createChainableTypeChecker';
import { date, number } from './localizers';
export { elementType }
export const numberFormat = createChainableTypeChecker(
(...args) => number.propType(...args))
export const dateFormat = createChainableTypeChecker(
(...args) => date.propType(...args))
export const disabled = createChainableTypeChecker(
(...args) => PropTypes.bool(...args));
disabled.acceptsArray = PropTypes.oneOfType([disabled, PropTypes.array])
export const accessor = PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
])
export const message = PropTypes.oneOfType([
PropTypes.node,
PropTypes.string,
PropTypes.func,
])
import PropTypes from 'prop-types';
import elementType
from 'prop-types-extra/lib/elementType';
import createChainableTypeChecker
from 'prop-types-extra/lib/utils/createChainableTypeChecker';
import { date, number } from './localizers';
export { elementType }
export const numberFormat = createChainableTypeChecker(
(...args) => number.propType(...args))
export const dateFormat = createChainableTypeChecker(
(...args) => date.propType(...args))
export const disabled = createChainableTypeChecker(
(...args) => PropTypes.bool(...args));
disabled.acceptsArray = PropTypes.oneOfType([disabled, PropTypes.array])
export const accessor = PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
])
export const message = PropTypes.oneOfType([
PropTypes.node,
PropTypes.string,
PropTypes.func,
import PropTypes from 'prop-types';
import elementType
from 'prop-types-extra/lib/elementType';
import createChainableTypeChecker
from 'prop-types-extra/lib/utils/createChainableTypeChecker';
import { date, number } from './localizers';
export { elementType }
export const numberFormat = createChainableTypeChecker(
(...args) => number.propType(...args))
export const dateFormat = createChainableTypeChecker(
(...args) => date.propType(...args))
export const disabled = createChainableTypeChecker(
(...args) => PropTypes.bool(...args));
disabled.acceptsArray = PropTypes.oneOfType([disabled, PropTypes.array])
export const accessor = PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
])
export const message = PropTypes.oneOfType([
export function requiredRoles(...roles) {
return createChainableTypeChecker((props, propName, component) => {
let missing;
roles.every(role => {
if (
!ValidComponentChildren.some(
props.children,
child => child.props.bsRole === role,
)
) {
missing = role;
return false;
}
return true;
});
export function exclusiveRoles(...roles) {
return createChainableTypeChecker((props, propName, component) => {
let duplicate;
roles.every(role => {
const childrenWithRole = ValidComponentChildren.filter(
props.children,
child => child.props.bsRole === role,
);
if (childrenWithRole.length > 1) {
duplicate = role;
return false;
}
return true;
});