[d24f17c] | 1 | import { both, anyPass } from 'ramda';
|
---|
| 2 | import isNotObj from './isNotObj';
|
---|
| 3 | import isString from './isString';
|
---|
| 4 | import isNumber from './isNumber';
|
---|
| 5 | import isBigInt from './isBigInt';
|
---|
| 6 | import isBoolean from './isBoolean';
|
---|
| 7 | import isUndefined from './isUndefined';
|
---|
| 8 | import isNull from './isNull';
|
---|
| 9 | import isSymbol from './isSymbol';
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * Checks if value is a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
|
---|
| 13 | * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
|
---|
| 14 | * for definition of what sub-types comprise a primitive.
|
---|
| 15 | *
|
---|
| 16 | * @func isPrimitive
|
---|
| 17 | * @memberOf RA
|
---|
| 18 | * @category Type
|
---|
| 19 | * @sig * -> Boolean
|
---|
| 20 | * @since {@link https://char0n.github.io/ramda-adjunct/2.32.0|v2.32.0}
|
---|
| 21 | * @param {*} val The value to test
|
---|
| 22 | * @return {boolean}
|
---|
| 23 | * @see {@link RA.isNotPrimitive|isNotPrimitive}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values|MDN Primitive values}, {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive|MDN Primitive}
|
---|
| 24 | * @example
|
---|
| 25 | *
|
---|
| 26 | * RA.isPrimitive("string"); //=> true
|
---|
| 27 | * RA.isPrimitive(1); //=> true
|
---|
| 28 | * RA.isPrimitive(new String("string")); //=> false
|
---|
| 29 | * RA.isPrimitive(new Number(1)); //=> false
|
---|
| 30 | */
|
---|
| 31 |
|
---|
| 32 | var isPrimitive = both(isNotObj, anyPass([isString, isNumber, isBigInt, isBoolean, isUndefined, isNull, isSymbol]));
|
---|
| 33 | export default isPrimitive; |
---|