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-obj package is a simple utility that allows you to check if a value is a non-null object. It is useful when you want to ensure that a value is an object type (excluding null, arrays, and other non-plain objects) before performing operations that are specific to objects.
Check if a value is a non-null object
This feature allows you to verify if a given value is a non-null object. It returns true for plain objects and false for null, arrays, functions, and other non-object types.
const isObj = require('is-obj');
console.log(isObj({})); // true
console.log(isObj(null)); // false
console.log(isObj([])); // false
console.log(isObj('hello')); // false
is-plain-object is a package that checks if an object is a plain object, that is, an object created by the Object constructor or one with a null prototype. It is similar to is-obj but also checks if the object is created by the Object constructor, which is-obj does not do.
isobject is another npm package that checks if a value is an object and not an array or null. It is similar to is-obj but also returns true for functions, which is-obj does not.
lodash.isplainobject is a method from the popular Lodash library that checks if a value is a plain object. It is more comprehensive than is-obj as it includes additional checks to determine if the object is plain.
Check if a value is an object
Keep in mind that array, function, regexp, etc, are objects in JavaScript.
See is-plain-obj
if you want to check for plain objects.
$ npm install is-obj
import isObject from 'is-obj';
isObject({foo: 'bar'});
//=> true
isObject([1, 2, 3]);
//=> true
isObject('foo');
//=> false
FAQs
Check if a value is an object
The npm package is-obj receives a total of 19,962,263 weekly downloads. As such, is-obj popularity was classified as popular.
We found that is-obj 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
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.