Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
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.
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
Part of the Lodash library, `lodash.issymbol` provides a similar functionality to `is-symbol` by checking if a given value is a Symbol. However, it comes as part of the larger Lodash utility library, which includes a wide range of functions for different types of data manipulation and checking, potentially making it a heavier choice for projects that only require symbol checking.
Is this an ES6 Symbol value?
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'))));
Simply clone the repo, npm install
, and run npm test
v1.0.4 - 2021-05-08
997d43c
node/install
instead of node/run
; use codecov
action fe0ccb7
3ab2748
f20fafe
nyc
on all tests 5c332fc
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, object-inspect
, tape
c5a58a8
bcd9258
33ae2d3
eslint
, @ljharb/eslint-config
, aud
, object-inspect
, tape
e53def0
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, object-inspect
ae36504
aae7f09
eslint
, @ljharb/eslint-config
, tape
d993fae
eslint
, @ljharb/eslint-config
, tape
51808a5
auto-changelog
, tape
c90040f
eslint
, tape
9fee159
prepublishOnly
script for npm 7+ b166afc
4a0fe3a
fbcbc9e
auto-changelog
; add aud
e66ab98
has-symbols
6ce7de5
1173c79
pull_request_target
event 94a6348
0692681
ed47833
FAQs
Determine if a value is an ES6 Symbol or not.
The npm package is-symbol receives a total of 24,153,898 weekly downloads. As such, is-symbol popularity was classified as popular.
We found that is-symbol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.