forked from sombochea/booler
updated version and name
This commit is contained in:
parent
7c8e9d81be
commit
6fe8e88d8d
@ -5,13 +5,13 @@ Convert string/values to Boolean in JavaScript.
|
|||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ npm i booler --save
|
$ npm i boolerjs --save
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const booler = require('booler')
|
const booler = require('boolerjs')
|
||||||
|
|
||||||
console.log(booler('f')) // return false
|
console.log(booler('f')) // return false
|
||||||
console.log(booler('t')) // return true
|
console.log(booler('t')) // return true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "booler",
|
"name": "boolerjs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Convert string to Boolean in JavaScript.",
|
"description": "Convert string to Boolean in JavaScript.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* @param {*} val Value to parse.
|
* @param {*} val Value to parse.
|
||||||
*/
|
*/
|
||||||
const booler = (val) => {
|
const booler = (val) => {
|
||||||
|
// transform to string lower case.
|
||||||
|
val = val + "".toLowerCase();
|
||||||
return val == 't' || val == 'true' || val == 1;
|
return val == 't' || val == 'true' || val == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user