Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 31,688,388 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.