fixed case sensitive

This commit is contained in:
Sambo Chea 2019-10-31 09:51:04 +07:00
parent 6fe8e88d8d
commit e855852ccc
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "boolerjs",
"version": "0.0.1",
"version": "0.0.2",
"description": "Convert string to Boolean in JavaScript.",
"main": "index.js",
"scripts": {

View File

@ -7,7 +7,7 @@
*/
const booler = (val) => {
// transform to string lower case.
val = val + "".toLowerCase();
val = (val + "").toLowerCase();
return val == 't' || val == 'true' || val == 1;
}

View File

@ -5,6 +5,10 @@ it('booler will be pass it to equal true', () => {
assert.equal(true, booler(true));
})
it('booler will be pass it to equal True', () => {
assert.equal(true, booler('True'));
})
it(`booler will be pass it to equal 'true'`, () => {
assert.equal(true, booler('true'));
})