time-to-botec/js/node_modules/@stdlib/assert/is-truthy
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

isTruthy

Test if a value is truthy.

Usage

var isTruthy = require( '@stdlib/assert/is-truthy' );

isTruthy( value )

Tests if a value is a value which translates to true when evaluated in a boolean context.

var bool = isTruthy( true );
// returns true

bool = isTruthy( [] );
// returns true

bool = isTruthy( false );
// returns false

bool = isTruthy( '' );
// returns false

bool = isTruthy( 0 );
// returns false

bool = isTruthy( NaN );
// returns false

bool = isTruthy( null );
// returns false

bool = isTruthy( void 0 );
// returns false

Examples

var isTruthy = require( '@stdlib/assert/is-truthy' );

var bool = isTruthy( true );
// returns true

bool = isTruthy( 'beep' );
// returns true

bool = isTruthy( 5 );
// returns true

bool = isTruthy( [] );
// returns true

bool = isTruthy( {} );
// returns true

bool = isTruthy( function foo() {} );
// returns true

bool = isTruthy( false );
// returns false

bool = isTruthy( 0 );
// returns false

bool = isTruthy( NaN );
// returns false

bool = isTruthy( '' );
// returns false

bool = isTruthy( void 0 );
// returns false

bool = isTruthy( null );
// returns false