Socket
Socket
Sign inDemoInstall

is-symbol

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-symbol

Determine if a value is an ES6 Symbol or not.


Version published
Weekly downloads
31M
increased by2.59%
Maintainers
1
Install size
41.2 kB
Created
Weekly downloads
 

Package description

What is is-symbol?

The `is-symbol` npm package is designed to provide a simple and efficient way to check if a given value is a Symbol. This can be particularly useful when working with ES6 Symbols, ensuring that operations or functions that require a symbol as an argument are provided with the correct type of value.

What are is-symbol's main functionalities?

Check if a value is a Symbol

This feature allows you to verify whether a given value is a Symbol. It's useful in scenarios where the type of a variable needs to be asserted before performing operations that are specific to Symbols.

const isSymbol = require('is-symbol');

console.log(isSymbol(Symbol('foo'))); // true
console.log(isSymbol('bar')); // false

Other packages similar to is-symbol

Readme

Source

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

Keywords

FAQs

Last updated on 08 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc