boolify-string
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -11,4 +11,11 @@ /* | ||
// http://qiita.com/Layzie/items/465e715dae14e2f601de | ||
function is(type, obj) { | ||
// e.g. [object String] | ||
var clas = Object.prototype.toString.call(obj).slice(8, -1); | ||
return obj !== undefined && obj !== null && clas === type; | ||
} | ||
module.exports = function(obj){ | ||
if (typeof obj !== 'string'){ | ||
if (!is('String', obj)) { | ||
return !!obj; | ||
@@ -15,0 +22,0 @@ } |
{ | ||
"name": "boolify-string", | ||
"description": "Check a string whether truthy or falsy.", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -12,2 +12,3 @@ "name": "sanemat", | ||
"devDependencies": { | ||
"conventional-changelog": "^0.1.0-beta.3", | ||
"david": "^6.1.6", | ||
@@ -27,5 +28,5 @@ "espower-loader": "^0.11.0", | ||
"keywords": [ | ||
"string", | ||
"bool", | ||
"environment", | ||
"bool" | ||
"string" | ||
], | ||
@@ -39,2 +40,3 @@ "license": "MIT", | ||
"scripts": { | ||
"changelog": "conventional-changelog -i changelog.md --overwrite --preset angular", | ||
"david": "david", | ||
@@ -41,0 +43,0 @@ "fixpack": "fixpack", |
# boolify-string | ||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image] | ||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Dependency Status][daviddm-url]][daviddm-image] | ||
@@ -66,1 +66,3 @@ Check a string whether truthy or falsy. | ||
[daviddm-image]: https://david-dm.org/sanemat/node-boolify-string | ||
[appveyor-url]: https://ci.appveyor.com/project/sanemat/node-boolify-string/branch/master | ||
[appveyor-image]: https://img.shields.io/appveyor/ci/sanemat/node-boolify-string/master.svg?style=flat-square&label=appveyor |
@@ -81,2 +81,13 @@ 'use strict'; | ||
}); | ||
describe('new String("")', function (){ | ||
it('new String("true") should be true', function(){ | ||
var target = new String('true'); // jshint ignore:line | ||
assert.equal(boolifyString(target), true); | ||
}); | ||
it('new String("false") should be false', function(){ | ||
var target = new String('false'); // jshint ignore:line | ||
assert.equal(boolifyString(target), false); | ||
}); | ||
}); | ||
}); |
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
10279
12
173
68
9