Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return has(nodeProps, token.name);
}
// Only the exact value operator ("=") can match non-strings
if (typeof nodePropValue !== 'string' || typeof value !== 'string') {
if (operator !== EXACT_ATTRIBUTE_OPERATOR) {
return false;
}
}
switch (operator) {
/**
* Represents an element with the att attribute whose value is exactly "val".
* @example
* [attr="val"] matches attr="val"
*/
case EXACT_ATTRIBUTE_OPERATOR:
return is(nodePropValue, value);
/**
* Represents an element with the att attribute whose value is a whitespace-separated
* list of words, one of which is exactly
* @example
* [rel~="copyright"] matches rel="copyright other"
*/
case WHITELIST_ATTRIBUTE_OPERATOR:
return nodePropValue.split(' ').indexOf(value) !== -1;
/**
* Represents an element with the att attribute, its value either being exactly the
* value or beginning with the value immediately followed by "-"
* @example
* [hreflang|="en"] matches hreflang="en-US"
*/
case HYPHENATED_ATTRIBUTE_OPERATOR:
return nodePropValue === value || nodePropValue.startsWith(`${value}-`);
function areHookInputsEqual(
nextDeps: Array,
prevDeps: Array | null
) {
// NOTE: The warnings that are used in ReactPartialRendererHooks are obsolete
// in a prepass, since these issues will be caught by a subsequent renderer anyway
if (prevDeps === null) {
return false
}
for (let i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
if (!is(nextDeps[i], prevDeps[i])) {
return false
}
}
return true
}
function isNonNegative(x) {
return typeof x === 'number' && isFinite(x) && x >= 0 && !is(x, -0);
}
requiredBy.isRequired = function requiredByRequired(props, propName, componentName, ...rest) {
const { [propName]: propValue } = props;
if (is(propValue, defaultValue)) {
return new TypeError(`${componentName}: prop “${propName}” must be present.`);
}
return propType.isRequired(props, propName, componentName, ...rest);
};
function requiredBy(props, propName, componentName, ...rest) {
if (props[requiredByPropName]) {
const { [propName]: propValue } = props;
if (is(propValue, defaultValue) || typeof propValue === 'undefined') {
return new TypeError(
`${componentName}: when ${requiredByPropName} is true, prop “${propName}” must be present.`,
);
}
}
return propType(props, propName, componentName, ...rest);
}
requiredBy.isRequired = function requiredByRequired(props, propName, componentName, ...rest) {