Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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 21,303,281 weekly downloads. As such, is-boolean-object popularity was classified as popular.
We found that is-boolean-object 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.