Socket
Socket
Sign inDemoInstall

boolean

Package Overview
Dependencies
Maintainers
5
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boolean

boolean converts lots of things to boolean.


Version published
Maintainers
5
Created

What is boolean?

The 'boolean' npm package is a simple utility that helps in converting various types of values to a boolean. It is particularly useful when dealing with values that are expected to be true or false but may come in different formats, such as strings, numbers, or even undefined.

What are boolean's main functionalities?

Convert any value to a boolean

This feature allows you to convert various types of values, including strings, numbers, and null or undefined, to a strict boolean value. It is useful for ensuring that you are working with a true boolean in your logic.

const boolean = require('boolean');
console.log(boolean('true')); // true
console.log(boolean('false')); // false
console.log(boolean('1')); // true
console.log(boolean('0')); // false
console.log(boolean(1)); // true
console.log(boolean(0)); // false
console.log(boolean(undefined)); // false
console.log(boolean(null)); // false
console.log(boolean('yes')); // true
console.log(boolean('no')); // false

Other packages similar to boolean

Keywords

FAQs

Package last updated on 16 Feb 2022

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