or
or :: [ Function ] β†’ a β†’ Boolean
Takes a list of validators
[validators][validators]
then returns a new function that receives a value
vv
(of any type) and reports whether the
vv
is valid for at least one of the previously defined
[validators][validators]
.
It is largely used within the library itself to evaluate or conditions:
isPrimitive.js
import or from './or';
import isBigInt from './isBigInt';
import isString from './isString';
import isFunction from './isFunction';
import isBoolean from './isBoolean';
import isNumber from './isNumber';
import isSymbol from './isSymbol';
import isUndefined from './isUndefined';
import isNull from './isNull';
​
/**
* Receives a value and reports whether it is a primitive of not
* @type {function(*=): boolean}
*/
const isPrimitive = or(isString, isFunction, isBoolean, isNumber, isBigInt, isSymbol, isNull, isUndefined);
​
export default isPrimitive;
​
Copy link