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

utilities

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utilities - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

34

lib/core.js

@@ -46,18 +46,2 @@ /*

this.objectToString = function (object) {
var objectArray = []
, val;
for (var key in object) {
val = object[key];
if (typeof val === 'object') {
objectArray.push(this.objectToString(val));
} else {
objectArray.push(key + '=' + val);
}
}
return objectArray.join(', ');
};
/*

@@ -103,4 +87,22 @@ * Mix in the properties on an object to another object

// Idea to add invalid number & Date from Michael J. Ryan,
// http://frugalcoder.us/post/2010/02/15/js-is-empty.aspx
this.isEmpty = function (val) {
// Empty string, null or undefined (these two are double-equal)
if (val === '' || val == undefined) {
return true;
}
// Invalid numerics
if (typeof val == 'number' && isNaN(val)) {
return true;
}
// Invalid Dates
if (val instanceof Date && isNaN(val.getTime())) {
return true;
}
return false;
};
})();
module.exports = core;

@@ -10,3 +10,3 @@ {

],
"version": "0.0.20",
"version": "0.0.21",
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",

@@ -13,0 +13,0 @@ "main": "./lib/index.js",

@@ -25,21 +25,3 @@ /*

'test simple objectToString for core': function () {
var expected = 'theyre=their, youre=your'
, result = core.objectToString({theyre: 'their', youre: 'your'});
assert.equal(expected, result);
}
, 'test objectToString with object as value in core': function () {
var expected = 'theyre=their, youre=youre, your=your'
, result = core.objectToString({theyre: 'their', youre: {youre: 'youre', your: 'your'}});
assert.equal(expected, result);
}
, 'test objectToString with array as value in core': function () {
var expected = 'theyre=their, 0=youre, 1=your'
, result = core.objectToString({theyre: 'their', youre: ['youre', 'your']});
assert.equal(expected, result);
}
, 'test simple mixin for core': function () {
'simple mixin for core': function () {
var expected = {secret: 'asdf', geddy: 'geddyKey'}

@@ -50,3 +32,3 @@ , result = core.mixin({secret: 'asdf'}, {geddy: 'geddyKey'});

, 'test mixin with overiding key for core': function () {
, 'mixin with overiding key for core': function () {
var expected = {secret: 'geddySecret', geddy: 'geddyKey'}

@@ -57,3 +39,3 @@ , result = core.mixin({secret: 'asdf'}, {geddy: 'geddyKey', secret: 'geddySecret'});

, 'test simple enhance for core': function () {
, 'simple enhance for core': function () {
var expected = {secret: 'asdf', geddy: 'geddyKey'}

@@ -64,3 +46,3 @@ , result = core.enhance({secret: 'asdf'}, {geddy: 'geddyKey'});

, 'test enhance with overiding key for core': function () {
, 'enhance with overiding key for core': function () {
var expected = {secret: 'geddySecret', geddy: 'geddyKey'}

@@ -71,4 +53,28 @@ , result = core.enhance({secret: 'asdf'}, {geddy: 'geddyKey', secret: 'geddySecret'});

, 'isEmpty, empty string (true)': function () {
assert.ok(core.isEmpty(''));
}
, 'isEmpty, null (true)': function () {
assert.ok(core.isEmpty(null));
}
, 'isEmpty, undefined (true)': function () {
assert.ok(core.isEmpty(null));
}
, 'isEmpty, NaN (true)': function () {
assert.ok(core.isEmpty(NaN));
}
, 'isEmpty, invalid Date (true)': function () {
assert.ok(core.isEmpty(new Date(NaN)));
}
, 'isEmpty, zero (false)': function () {
assert.ok(!core.isEmpty(0));
}
};
module.exports = tests;
module.exports = tests;
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