source: node_modules/ramda-adjunct/es/isPrimitive.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import { both, anyPass } from 'ramda';
2import isNotObj from './isNotObj';
3import isString from './isString';
4import isNumber from './isNumber';
5import isBigInt from './isBigInt';
6import isBoolean from './isBoolean';
7import isUndefined from './isUndefined';
8import isNull from './isNull';
9import 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
32var isPrimitive = both(isNotObj, anyPass([isString, isNumber, isBigInt, isBoolean, isUndefined, isNull, isSymbol]));
33export default isPrimitive;
Note: See TracBrowser for help on using the repository browser.