Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
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 22,031,953 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.