source: node_modules/ramda-adjunct/src/isSymbol.js@ d24f17c

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

Initial commit

  • Property mode set to 100644
File size: 761 bytes
Line 
1import { type, curryN } from 'ramda';
2
3/**
4 * Checks if input value is a Symbol.
5 *
6 * @func isSymbol
7 * @memberOf RA
8 * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
9 * @category Type
10 * @sig * -> Boolean
11 * @param {*} val The value to test
12 * @return {boolean}
13 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol|MDN Symbol}
14 * @example
15 *
16 * RA.isSymbol(Symbol('1')); //=> true
17 * RA.isSymbol(Symbol(1)); //=> true
18 * RA.isSymbol('string'); //=> false
19 * RA.isSymbol(undefined); //=> false
20 * RA.isSymbol(null); //=> false
21 */
22const isSymbol = curryN(
23 1,
24 (val) =>
25 typeof val === 'symbol' ||
26 (typeof val === 'object' && type(val) === 'Symbol')
27);
28
29export default isSymbol;
Note: See TracBrowser for help on using the repository browser.