New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@reflexions/string-to-boolean

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reflexions/string-to-boolean

Converts strings to booleans, treating '0', 'false', and 'off' as false

latest
npmnpm
Version
1.2.0
Version published
Maintainers
3
Created
Source

@reflexions/string-to-boolean

Converts strings to booleans, treating '0', 'false', and 'off' as false. Useful for environment variables and form inputs.

Install

npm install @reflexions/string-to-boolean

Usage

import stringToBoolean from '@reflexions/string-to-boolean';

stringToBoolean('true')   // true
stringToBoolean('1')      // true
stringToBoolean('false')  // false
stringToBoolean('0')      // false
stringToBoolean('')       // false

Behavior

InputOutputNotes
true / falsetrue / falseBooleans pass through unchanged
'true', 'TRUE', 'True'trueCase-insensitive
'false', 'FALSE', 'False'falseCase-insensitive
'1', 'yes', 'on', 'anything'trueAny non-empty, non-falsy string
'0'false
'off', 'OFF'falseCase-insensitive
''falseEmpty string
null, undefinedfalse

Keywords

string

FAQs

Package last updated on 26 Feb 2026

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