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.
is-boolean-object
Advanced tools
Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
The is-boolean-object npm package is a utility that allows you to determine if a given value is a boolean object. This can be particularly useful in scenarios where you need to validate or enforce data types in your JavaScript code.
Check if a value is a boolean object
This feature allows you to check if a given value is a boolean object. The code sample demonstrates how to use the is-boolean-object package to differentiate between primitive boolean values and boolean objects.
const isBooleanObject = require('is-boolean-object');
console.log(isBooleanObject(true)); // false
console.log(isBooleanObject(false)); // false
console.log(isBooleanObject(new Boolean(true))); // true
console.log(isBooleanObject(new Boolean(false))); // true
The is-boolean package is a utility that checks if a value is a boolean primitive. Unlike is-boolean-object, it does not check for boolean objects created with the Boolean constructor.
The lodash.isboolean package is part of the Lodash library and checks if a value is a boolean primitive. It is similar to is-boolean but is part of a larger utility library, offering more functionality beyond just type checking.
The is-primitive package checks if a value is a primitive type, including boolean primitives. It does not specifically check for boolean objects, making it broader in scope compared to is-boolean-object.
Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
var isBoolean = require('is-boolean-object');
var assert = require('assert');
assert.notOk(isBoolean(undefined));
assert.notOk(isBoolean(null));
assert.notOk(isBoolean('foo'));
assert.notOk(isBoolean(function () {}));
assert.notOk(isBoolean([]));
assert.notOk(isBoolean({}));
assert.notOk(isBoolean(/a/g));
assert.notOk(isBoolean(new RegExp('a', 'g')));
assert.notOk(isBoolean(new Date()));
assert.notOk(isBoolean(42));
assert.notOk(isBoolean(NaN));
assert.notOk(isBoolean(Infinity));
assert.ok(isBoolean(new Boolean(42)));
assert.ok(isBoolean(false));
assert.ok(isBoolean(Object(false)));
assert.ok(isBoolean(true));
assert.ok(isBoolean(Object(true)));
Simply clone the repo, npm install
, and run npm test
FAQs
Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
The npm package is-boolean-object receives a total of 30,143,371 weekly downloads. As such, is-boolean-object popularity was classified as popular.
We found that is-boolean-object 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.