Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stdlib/assert-is-boolean

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/assert-is-boolean

Test if a value is a boolean.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @stdlib/assert-is-boolean?

@stdlib/assert-is-boolean is a utility package that provides functions to check if a value is a boolean primitive or a boolean object.

What are @stdlib/assert-is-boolean's main functionalities?

Check if a value is a boolean primitive

This feature allows you to check if a given value is a boolean primitive. It returns true for boolean primitives and false for other types.

const isBoolean = require('@stdlib/assert-is-boolean').isPrimitive;
console.log(isBoolean(true)); // => true
console.log(isBoolean(false)); // => true
console.log(isBoolean('true')); // => false

Check if a value is a boolean object

This feature allows you to check if a given value is a boolean object. It returns true for boolean objects and false for other types.

const isBooleanObject = require('@stdlib/assert-is-boolean').isObject;
console.log(isBooleanObject(new Boolean(true))); // => true
console.log(isBooleanObject(true)); // => false

Check if a value is either a boolean primitive or a boolean object

This feature allows you to check if a given value is either a boolean primitive or a boolean object. It returns true for both boolean primitives and objects, and false for other types.

const isBoolean = require('@stdlib/assert-is-boolean');
console.log(isBoolean(true)); // => true
console.log(isBoolean(new Boolean(false))); // => true
console.log(isBoolean('false')); // => false

Other packages similar to @stdlib/assert-is-boolean

Keywords

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc