Comparing version 0.1.2 to 0.1.3
'use strict'; | ||
var boolean = function (value) { | ||
const boolean = function (value) { | ||
if (typeof value === 'string') { | ||
@@ -9,3 +9,3 @@ return /^(true|t|yes|y|1)$/i.test(value.trim()); | ||
if (typeof value === 'number') { | ||
return value === 1; | ||
return value !== 0; | ||
} | ||
@@ -12,0 +12,0 @@ |
{ | ||
"name": "boolean", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "boolean converts lots of things to boolean.", | ||
@@ -15,8 +15,8 @@ "contributors": [ | ||
], | ||
"main": "lib/boolean.js", | ||
"main": "dist/boolean.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"assertthat": "0.5.3", | ||
"grunt": "0.4.5", | ||
"tourism": "0.14.1" | ||
"assertthat": "0.9.0", | ||
"roboter": "0.15.3", | ||
"roboter-server": "0.15.3" | ||
}, | ||
@@ -23,0 +23,0 @@ "repository": { |
@@ -7,3 +7,3 @@ # boolean | ||
```bash | ||
```shell | ||
$ npm install boolean | ||
@@ -46,5 +46,7 @@ ``` | ||
This module can be built using [Grunt](http://gruntjs.com/). Besides running the tests, this also analyses the code. To run Grunt, go to the folder where you have installed boolean and run `grunt`. You need to have [grunt-cli](https://github.com/gruntjs/grunt-cli) installed. | ||
To build this module use [roboter](https://www.npmjs.com/package/roboter). | ||
$ grunt | ||
```shell | ||
$ bot | ||
``` | ||
@@ -54,3 +56,3 @@ ## License | ||
The MIT License (MIT) | ||
Copyright (c) 2014-2016 the native web. | ||
Copyright (c) 2014-2017 the native web. | ||
@@ -57,0 +59,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
'use strict'; | ||
var assert = require('assertthat'); | ||
const assert = require('assertthat'); | ||
var boolean = require('../lib/boolean'); | ||
const boolean = require('../lib/boolean'); | ||
suite('boolean', function () { | ||
test('is a function.', function (done) { | ||
suite('boolean', () => { | ||
test('is a function.', done => { | ||
assert.that(boolean).is.ofType('function'); | ||
@@ -13,4 +13,4 @@ done(); | ||
suite('undefined', function () { | ||
test('returns false.', function (done) { | ||
suite('undefined', () => { | ||
test('returns false.', done => { | ||
assert.that(boolean(undefined)).is.false(); | ||
@@ -21,4 +21,4 @@ done(); | ||
suite('object', function () { | ||
test('null returns false.', function (done) { | ||
suite('object', () => { | ||
test('null returns false.', done => { | ||
assert.that(boolean(null)).is.false(); | ||
@@ -28,3 +28,3 @@ done(); | ||
test('{} returns false.', function (done) { | ||
test('{} returns false.', done => { | ||
assert.that(boolean({})).is.false(); | ||
@@ -35,4 +35,4 @@ done(); | ||
suite('boolean', function () { | ||
test('true returns true.', function (done) { | ||
suite('boolean', () => { | ||
test('true returns true.', done => { | ||
assert.that(boolean(true)).is.true(); | ||
@@ -42,3 +42,3 @@ done(); | ||
test('false returns false.', function (done) { | ||
test('false returns false.', done => { | ||
assert.that(boolean(false)).is.false(); | ||
@@ -49,4 +49,4 @@ done(); | ||
suite('string', function () { | ||
test('"true" returns true.', function (done) { | ||
suite('string', () => { | ||
test('"true" returns true.', done => { | ||
assert.that(boolean('true')).is.true(); | ||
@@ -56,3 +56,3 @@ done(); | ||
test('"false" returns false.', function (done) { | ||
test('"false" returns false.', done => { | ||
assert.that(boolean('false')).is.false(); | ||
@@ -62,3 +62,3 @@ done(); | ||
test('"TRUE" returns true.', function (done) { | ||
test('"TRUE" returns true.', done => { | ||
assert.that(boolean('TRUE')).is.true(); | ||
@@ -68,3 +68,3 @@ done(); | ||
test('"FALSE" returns false.', function (done) { | ||
test('"FALSE" returns false.', done => { | ||
assert.that(boolean('FALSE')).is.false(); | ||
@@ -74,3 +74,3 @@ done(); | ||
test('"t" returns true.', function (done) { | ||
test('"t" returns true.', done => { | ||
assert.that(boolean('t')).is.true(); | ||
@@ -80,3 +80,3 @@ done(); | ||
test('"f" returns false.', function (done) { | ||
test('"f" returns false.', done => { | ||
assert.that(boolean('f')).is.false(); | ||
@@ -86,3 +86,3 @@ done(); | ||
test('"T" returns true.', function (done) { | ||
test('"T" returns true.', done => { | ||
assert.that(boolean('T')).is.true(); | ||
@@ -92,3 +92,3 @@ done(); | ||
test('"F" returns false.', function (done) { | ||
test('"F" returns false.', done => { | ||
assert.that(boolean('F')).is.false(); | ||
@@ -98,3 +98,3 @@ done(); | ||
test('"yes" returns true.', function (done) { | ||
test('"yes" returns true.', done => { | ||
assert.that(boolean('yes')).is.true(); | ||
@@ -104,3 +104,3 @@ done(); | ||
test('"no" returns false.', function (done) { | ||
test('"no" returns false.', done => { | ||
assert.that(boolean('no')).is.false(); | ||
@@ -110,3 +110,3 @@ done(); | ||
test('"YES" returns true.', function (done) { | ||
test('"YES" returns true.', done => { | ||
assert.that(boolean('YES')).is.true(); | ||
@@ -116,3 +116,3 @@ done(); | ||
test('"NO" returns false.', function (done) { | ||
test('"NO" returns false.', done => { | ||
assert.that(boolean('NO')).is.false(); | ||
@@ -122,3 +122,3 @@ done(); | ||
test('"y" returns true.', function (done) { | ||
test('"y" returns true.', done => { | ||
assert.that(boolean('y')).is.true(); | ||
@@ -128,3 +128,3 @@ done(); | ||
test('"n" returns false.', function (done) { | ||
test('"n" returns false.', done => { | ||
assert.that(boolean('n')).is.false(); | ||
@@ -134,3 +134,3 @@ done(); | ||
test('"Y" returns true.', function (done) { | ||
test('"Y" returns true.', done => { | ||
assert.that(boolean('Y')).is.true(); | ||
@@ -140,3 +140,3 @@ done(); | ||
test('"N" returns false.', function (done) { | ||
test('"N" returns false.', done => { | ||
assert.that(boolean('N')).is.false(); | ||
@@ -146,3 +146,3 @@ done(); | ||
test('"1" returns true.', function (done) { | ||
test('"1" returns true.', done => { | ||
assert.that(boolean('1')).is.true(); | ||
@@ -152,3 +152,3 @@ done(); | ||
test('"0" returns false.', function (done) { | ||
test('"0" returns false.', done => { | ||
assert.that(boolean('0')).is.false(); | ||
@@ -158,3 +158,3 @@ done(); | ||
test('"contains-the-letter-t" returns false.', function (done) { | ||
test('"contains-the-letter-t" returns false.', done => { | ||
assert.that(boolean('contains-the-letter-t')).is.false(); | ||
@@ -164,3 +164,3 @@ done(); | ||
test('"contains-the-word-yes" returns false.', function (done) { | ||
test('"contains-the-word-yes" returns false.', done => { | ||
assert.that(boolean('noyesno')).is.false(); | ||
@@ -170,3 +170,3 @@ done(); | ||
test('arbitrary string returns false.', function (done) { | ||
test('arbitrary string returns false.', done => { | ||
assert.that(boolean('123')).is.false(); | ||
@@ -176,3 +176,3 @@ done(); | ||
test('trims whitespace.', function (done) { | ||
test('trims whitespace.', done => { | ||
assert.that(boolean(' true ')).is.true(); | ||
@@ -183,4 +183,4 @@ done(); | ||
suite('number', function () { | ||
test('1 returns true.', function (done) { | ||
suite('number', () => { | ||
test('1 returns true.', done => { | ||
assert.that(boolean(1)).is.true(); | ||
@@ -190,3 +190,3 @@ done(); | ||
test('0 returns false.', function (done) { | ||
test('0 returns false.', done => { | ||
assert.that(boolean(0)).is.false(); | ||
@@ -196,4 +196,4 @@ done(); | ||
test('123 returns false.', function (done) { | ||
assert.that(boolean(123)).is.false(); | ||
test('123 returns true.', done => { | ||
assert.that(boolean(123)).is.true(); | ||
done(); | ||
@@ -200,0 +200,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9091
9
216
61