Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opencadc-js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencadc-js - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

24

lib/org.opencadc.js

@@ -131,2 +131,25 @@ 'use strict';

/**
* Utility class to check for proper true or false values.
*
* @constructor
*/
function BooleanUtil()
{
var _TRUTH_REGEX_ =
new RegExp('^' + '\\s*' + '\\b' + 'y[es]?|true' + '\\b' + '\\s*' + '$','i');
/**
* Return whether the given value is true, or 'positive'. This will test for
* things like 'true', true, 1, 'yes', 'y'.
*
* @param {*} _val
*/
this.truthiness = function(_val)
{
return (_val == true)
|| ((typeof _val === 'string') && _TRUTH_REGEX_.test(_val));
};
}
/**
* Format numeric values for output.

@@ -372,2 +395,3 @@ *

exports.StringUtil = StringUtil;
exports.BooleanUtil = BooleanUtil;
exports.ArrayUtil = ArrayUtil;

@@ -374,0 +398,0 @@ exports.NumberFormat = NumberFormat;

2

package.json
{
"name": "opencadc-js",
"version": "2.0.6",
"version": "2.0.7",
"description": "OpenCADC JavaScript libraries.",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -315,2 +315,49 @@ var assert = require('assert');

});
});
});
describe('BooleanUtil values.', function ()
{
var testSubject = new opencadcJS.BooleanUtil();
it ('Check base primitive.', function ()
{
assert.ok(testSubject.truthiness(true));
assert.ok(testSubject.truthiness(1), 'Check value of 1.');
});
it ('Check for "y"', function ()
{
assert.ok(testSubject.truthiness('y'), 'Check for "y"');
});
it ('Check for "Y"', function ()
{
assert.ok(testSubject.truthiness('Y'), 'Check for "Y"');
});
it ('Check for "yes"', function ()
{
assert.ok(testSubject.truthiness('Yes'), 'Check for "Yes"');
assert.ok(testSubject.truthiness('yEs'), 'Check for "yEs"');
});
it ('Check string "true"', function ()
{
assert.ok(testSubject.truthiness('true'));
});
it ('Check string "false"', function ()
{
assert.ok(testSubject.truthiness('false') === false);
});
it ('Check string "no"', function ()
{
assert.ok(testSubject.truthiness('no') === false);
});
it ('Check string "n"', function ()
{
assert.ok(testSubject.truthiness('n') === false);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc