Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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
FAQs
Determine if a value is an ES6 Symbol or not.
The npm package is-symbol receives a total of 33,679,109 weekly downloads. As such, is-symbol popularity was classified as popular.
We found that is-symbol demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.