is-symbol

Determine if a value is an ES6 Symbol or not.

MIT 7 个版本
安装
npm install is-symbol
yarn add is-symbol
pnpm add is-symbol
bun add is-symbol
README

is-symbol Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this an ES6 Symbol value?

Example

var isSymbol = require('is-symbol');
assert(!isSymbol(function () {}));
assert(!isSymbol(null));
assert(!isSymbol(function* () { yield 42; return Infinity; });

assert(isSymbol(Symbol.iterator));
assert(isSymbol(Symbol('foo')));
assert(isSymbol(Symbol.for('foo')));
assert(isSymbol(Object(Symbol('foo'))));

Tests

Simply clone the repo, npm install, and run npm test

版本列表
1.1.1 2024-12-13
1.1.0 2024-12-02
1.0.4 2021-05-08
1.0.3 2019-11-21
1.0.2 2018-09-21
1.0.1 2015-01-26
1.0.0 2015-01-24