boolify-string
Check a string whether truthy or falsy.
Use case
Read from environment variable, sometimes these are 'True', 'false', '1', '', undefined, etc.
if (boolifyString(process.env.CI)){
something_do();
}
Install
$ npm install --save boolify-string
Usage
var boolifyString = require('boolify-string');
boolifyString('true');
boolifyString('TRUE');
boolifyString('True');
boolifyString('false');
boolifyString('{}');
boolifyString('foo');
boolifyString('');
boolifyString('1');
boolifyString('-1');
boolifyString('0');
boolifyString('[]');
boolifyString('undefined');
boolifyString('null');
boolifyString(true);
boolifyString(false);
boolifyString({});
boolifyString(1);
boolifyString(-1);
boolifyString(0);
boolifyString([]);
boolifyString(undefined);
boolifyString(null);
boolifyString(new String('true'));
boolifyString(new String('false'));
boolifyString('y');
boolifyString('Y');
boolifyString('yes');
boolifyString('Yes');
boolifyString('YES');
boolifyString('n');
boolifyString('N');
boolifyString('no');
boolifyString('No');
boolifyString('NO');
boolifyString('true');
boolifyString('True');
boolifyString('TRUE');
boolifyString('false');
boolifyString('False');
boolifyString('FALSE');
boolifyString('on');
boolifyString('On');
boolifyString('ON');
boolifyString('off');
boolifyString('Off');
boolifyString('OFF');
Simular
Changelog
changelog
License
Copyright (c) 2014-2015 sanemat. Licensed under the MIT license.