@zerodep/is-symbol
v2.0.11
Published
A utility to determine if a value is a Symbol
Downloads
6
Readme
@zerodep/is-symbol
A simple, performant utility to determine if a value is a Symbol.
Full documentation is available at the zerodep.app page.
Examples
All @zerodep packages support both ESM and CJS.
import { isSymbol } from '@zerodep/is-symbol';
// or
const { isSymbol } = require('@zerodep/is-symbol');
Positive Response
import { isSymbol } from '@zerodep/app';
isSymbol(Symbol()); // true
Negative Response
isSymbol(['a', 'b', 'c']); // false
isSymbol(1000n); // false
isSymbol(true); // false
isSymbol(new Date()); // false
isSymbol(''); // false
isSymbol(new Error('message')); // false
isSymbol(3.14); // false
isSymbol(() => 'function'); // false
isSymbol(42); // false
isSymbol(
new Map([
['a', 1],
['b', 2],
])
); // false
isSymbol(null); // false
isSymbol({ an: 'object' }); // false
isSymbol(new Promise(() => {})); // false
isSymbol(/[regex]+/gi); // false
isSymbol(new Set([1, 2, 3])); // false
isSymbol('a string'); // false
isSymbol(new Int32Array(2)); // false
isSymbol(undefined); // false