to-boolean-x

to-boolean-x JS library on GitHub to-boolean-x JS library on npm Download to-boolean-x JS library

Converts argument to a value of type Boolean.

Version 2.1.1 License MIT
to-boolean-x has no homepage
to-boolean-x JS library on GitHub
to-boolean-x JS library on npm
Download to-boolean-x JS library
Keywords
toBooleanmodulejavascriptnodejsbrowser

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

to-boolean-x

Converts argument to a value of type Boolean.

module.exports(value)boolean

The abstract operation ToBoolean converts argument to a value of type Boolean.

Kind: Exported function
Returns: boolean - 'true' if value is truthy; otherwise 'false'.

Param Type Description
value * The value to be converted.

Example

import toBoolean from 'to-boolean-x';

console.log(toBoolean(null)); // false
console.log(toBoolean('')); // false
console.log(toBoolean(1)); // true
console.log(toBoolean('0')); // true