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

str2bool

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

str2bool

Converts a string or number like boolean to true / false of type boolean.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

str2bool

Converts a string or number like boolean to true / false of type boolean.

install

npm install str2bool --save

test

npm test

Usage

const str2bool = require('str2bool');

console.log(str2bool(true)); // true
console.log(str2bool('true')); // true
console.log(str2bool(1)); // true
console.log(str2bool('1')); // true

console.log(str2bool(false)); // false
console.log(str2bool('false')); // fasle
console.log(str2bool(0)); // false
console.log(str2bool('0')); // false

console.log(str2bool('true ')); // false
console.log(str2bool(223)); // false
console.log(str2bool('223')); // false
console.log(str2bool('')); // false
console.log(str2bool(' ')); // false
console.log(str2bool()); // false

Keywords

FAQs

Package last updated on 14 Jan 2018

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