opencadc-js
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -139,3 +139,6 @@ 'use strict'; | ||
new RegExp('^' + '\\s*' + '\\b' + 'y[es]?|true' + '\\b' + '\\s*' + '$','i'); | ||
var _FALSE_REGEX_ = | ||
new RegExp('^' + '\\s*' + '\\b' + 'n[o]?|false' + '\\b' + '\\s*' + '$','i'); | ||
/** | ||
@@ -147,3 +150,3 @@ * Return whether the given value is true, or 'positive'. This will test for | ||
*/ | ||
this.truthiness = function(_val) | ||
this.isTrueValue = function(_val) | ||
{ | ||
@@ -153,2 +156,14 @@ return (_val == true) | ||
}; | ||
/** | ||
* Return whether the given value is false, or 'negative'. This will test for | ||
* things like 'false', false, 0, 'no', 'n'. | ||
* | ||
* @param {*} _val | ||
*/ | ||
this.isFalseValue = function(_val) | ||
{ | ||
return (_val == false) | ||
|| ((typeof _val === 'string') && _FALSE_REGEX_.test(_val)); | ||
}; | ||
} | ||
@@ -155,0 +170,0 @@ |
{ | ||
"name": "opencadc-js", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "OpenCADC JavaScript libraries.", | ||
"dependencies": { | ||
"jquery": "^3.1.0", | ||
"jsdom": "^9.9.1", | ||
"uglify-js": "^2.7.5" | ||
}, | ||
"devDependencies": { | ||
"jquery": "^3.1.0", | ||
"jsdom": "^9.9.1", | ||
"jsdom-global": "^2.1.1", | ||
@@ -12,0 +12,0 @@ "mocha": "^3.2.0" |
@@ -317,3 +317,3 @@ var assert = require('assert'); | ||
describe('BooleanUtil values.', function () | ||
describe('BooleanUtil true values.', function () | ||
{ | ||
@@ -324,4 +324,4 @@ var testSubject = new opencadcJS.BooleanUtil(); | ||
{ | ||
assert.ok(testSubject.truthiness(true)); | ||
assert.ok(testSubject.truthiness(1), 'Check value of 1.'); | ||
assert.ok(testSubject.isTrueValue(true)); | ||
assert.ok(testSubject.isTrueValue(1), 'Check value of 1.'); | ||
}); | ||
@@ -331,3 +331,3 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('y'), 'Check for "y"'); | ||
assert.ok(testSubject.isTrueValue('y'), 'Check for "y"'); | ||
}); | ||
@@ -337,3 +337,3 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('Y'), 'Check for "Y"'); | ||
assert.ok(testSubject.isTrueValue('Y'), 'Check for "Y"'); | ||
}); | ||
@@ -343,4 +343,4 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('Yes'), 'Check for "Yes"'); | ||
assert.ok(testSubject.truthiness('yEs'), 'Check for "yEs"'); | ||
assert.ok(testSubject.isTrueValue('Yes'), 'Check for "Yes"'); | ||
assert.ok(testSubject.isTrueValue('yEs'), 'Check for "yEs"'); | ||
}); | ||
@@ -350,3 +350,3 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('true')); | ||
assert.ok(testSubject.isTrueValue('true')); | ||
}); | ||
@@ -356,3 +356,3 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('false') === false); | ||
assert.ok(testSubject.isTrueValue('false') === false); | ||
}); | ||
@@ -362,3 +362,3 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('no') === false); | ||
assert.ok(testSubject.isTrueValue('no') === false); | ||
}); | ||
@@ -368,4 +368,51 @@ | ||
{ | ||
assert.ok(testSubject.truthiness('n') === false); | ||
assert.ok(testSubject.isTrueValue('n') === false); | ||
}); | ||
}); | ||
describe('BooleanUtil false values.', function () | ||
{ | ||
var testSubject = new opencadcJS.BooleanUtil(); | ||
it ('Check base primitive.', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue(false)); | ||
assert.ok(testSubject.isFalseValue(0), 'Check value of 0.'); | ||
}); | ||
it ('Check for "n"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('n'), 'Check for "n"'); | ||
}); | ||
it ('Check for "Y"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('N'), 'Check for "N"'); | ||
}); | ||
it ('Check for "no"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('No'), 'Check for "No"'); | ||
assert.ok(testSubject.isFalseValue('nO'), 'Check for "nO"'); | ||
}); | ||
it ('Check string "false"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('false')); | ||
}); | ||
it ('Check string "true"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('true') === false); | ||
}); | ||
it ('Check string "yes"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('yes') === false); | ||
}); | ||
it ('Check string "y"', function () | ||
{ | ||
assert.ok(testSubject.isFalseValue('y') === 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
241289
1
3579
4
- Removedjquery@^3.1.0
- Removedjsdom@^9.9.1
- Removedabab@1.0.4(transitive)
- Removedacorn@4.0.13(transitive)
- Removedacorn-globals@3.1.0(transitive)
- Removedajv@6.12.6(transitive)
- Removedarray-equal@1.0.2(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcontent-type-parser@1.0.2(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcssom@0.3.8(transitive)
- Removedcssstyle@0.2.37(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhtml-encoding-sniffer@1.0.2(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjquery@3.7.1(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjsdom@9.12.0(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlevn@0.3.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednwmatcher@1.4.4(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedparse5@1.5.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsax@1.4.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedsymbol-tree@3.2.4(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtype-check@0.3.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedwebidl-conversions@3.0.14.0.2(transitive)
- Removedwhatwg-encoding@1.0.5(transitive)
- Removedwhatwg-url@4.8.0(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedxml-name-validator@2.0.1(transitive)