2.1.1 • Published 5 years ago

to-boolean-x v2.1.1

Weekly downloads
14,351
License
MIT
Repository
github
Last release
5 years ago

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'.

ParamTypeDescription
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