@silen/is-symbol
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

is-symbol

Determine if a value is Symbol

install

npm i @silen/is-symbol

api

  • declare function isSymbol(val: any): boolean;

usage

const { isSymbol } = require('@silen/is-symbol');
// or
import { isSymbol } from '@silen/is-symbol';

console.log(isSymbol(new Buffer(4)));
console.log(isSymbol(Buffer.alloc(4)));
console.log(isSymbol(undefined));
console.log(isSymbol(null));
console.log(isSymbol(''));
console.log(isSymbol(true));
console.log(isSymbol(0));
console.log(isSymbol(1));
console.log(isSymbol(1.0));
console.log(isSymbol('string'));
console.log(isSymbol({}));
console.log(isSymbol(function foo() {}));
console.log(isSymbol(Symbol()));
console.log(isSymbol(new Set));
console.log(isSymbol(new Map));
console.log(isSymbol(new WeakMap));
console.log(isSymbol(new WeakSet));

// or
console.log(window.Type.isSymbol(new WeakSet));

This is a demo for testing the usage of isSymbol from @silen/is-symbol module. You can try the others and do likewise.

others

Package Sidebar

Install

npm i @silen/is-symbol

Weekly Downloads

4

Version

1.0.3

License

MIT

Unpacked Size

8.18 kB

Total Files

9

Last publish

Collaborators

  • silentsun