booler/README.md

80 lines
1.6 KiB
Markdown
Raw Normal View History

2019-10-31 09:07:04 +07:00
# Booler: Convert any values to Boolean.
2020-04-17 20:16:22 +07:00
[![Build Status](https://drone.cubetiqs.com/api/badges/CUBETIQ/booler/status.svg)](https://drone.cubetiqs.com/CUBETIQ/booler)
2019-10-31 09:07:04 +07:00
Convert string/values to Boolean in JavaScript.
2019-10-31 09:14:06 +07:00
## Installing
2019-10-31 09:07:04 +07:00
2019-10-31 09:14:06 +07:00
```shell
2019-10-31 09:45:34 +07:00
$ npm i boolerjs --save
2019-10-31 09:14:06 +07:00
```
## Example
2019-10-31 09:07:04 +07:00
```js
2019-12-06 12:40:17 +07:00
const assert = require('assert');
2019-10-31 09:45:34 +07:00
const booler = require('boolerjs')
2019-10-31 09:07:04 +07:00
2019-12-06 12:40:17 +07:00
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'));
})
it(`booler will be pass it to equal 't'`, () => {
assert.equal(true, booler('t'));
})
it(`booler will be pass it to equal '1'`, () => {
assert.equal(true, booler('1'));
})
it('booler will be pass it to equal 1', () => {
assert.equal(true, booler(1));
})
it('booler will be pass it to equal false', () => {
assert.equal(false, booler(false));
})
it(`booler will be pass it to equal 'false'`, () => {
assert.equal(false, booler('false'));
})
it(`booler will be pass it to equal 'f'`, () => {
assert.equal(false, booler('f'));
})
it(`booler will be pass it to equal '0'`, () => {
assert.equal(false, booler(0));
})
it('booler will be pass it to equal 0', () => {
assert.equal(false, booler(0));
})
2019-10-31 09:07:04 +07:00
```
2019-10-31 09:14:06 +07:00
## Run Test
2019-10-31 09:07:04 +07:00
```shell
$ npm run test
```
2019-10-31 09:14:06 +07:00
## Contribution
if you any ideas or concepts, please kindly provide and support with us.
### Author
Name: <b>Sambo Chea</b> <br/>
Email: sombochea@cubetiqs.com