New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

JSUS

Package Overview
Dependencies
Maintainers
2
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

JSUS - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

2

lib/array.js

@@ -153,3 +153,3 @@ (function (JSUS) {

ARRAY._latinSquare = function (S, N, self) {

@@ -156,0 +156,0 @@ var self = ('undefined' === typeof self) ? true : self;

@@ -64,2 +64,17 @@ (function (JSUS) {

/**
* Returns TRUE if an object has no properties,
* FALSE otherwise.
*
*/
OBJ.isEmpty = function (o) {
for (var key in o) {
if (o.hasOwnProperty(key)) {
return false;
}
}
return true;
};
/**
* Returns the number of own properties, prototype

@@ -262,6 +277,11 @@ * chain excluded, stored in the object / list.

/**
* Like OBJ.merge, but only overlapping keys are copied.
* Appends / merges the values of the properties of obj2 into a
* a new property called 'key' of obj1.
*
* Returns a new object, the original ones are not modified.
*
* This method is useful when we want to merge into a larger
* configuration (e.g. min, max, value) object another one that
* contains just the values for one of the properties (e.g. value).
*
* @see OBJ.merge

@@ -275,5 +295,6 @@ *

if (obj2.hasOwnProperty(i)) {
if ( 'object' === typeof obj1[i] ) {
clone[i][key] = obj2[i];
}
if (!clone[i] || 'object' === typeof clone[i]) {
clone[i] = {};
}
clone[i][key] = obj2[i];
}

@@ -283,16 +304,4 @@ }

};
/**
* Merges on key called 'value'.
*
* @see OBJ.mergeOnKey
*
* @deprecated
*
*/
OBJ.mergeOnValue = function (obj1, obj2) {
return OBJ.mergeOnKey(obj1, obj2, 'value');
};
/**
* Creates a copy of an object containing only the

@@ -299,0 +308,0 @@ * properties passed as second parameter.

{
"name": "JSUS",
"description": "JavaScript UtilS. Collection of general purpose functions. JSUS helps!",
"version": "0.3.1",
"version": "0.3.2",
"keywords": [ "util", "general", "array", "eval", "time", "date", "object"],

@@ -6,0 +6,0 @@ "author": "Stefano Balietti <futur.dorko@gmail.com>",

@@ -216,4 +216,44 @@ var util = require('util');

describe('#mergeOnKey()', function() {
var merge_in = {
a: {max: 10,
min: 1,
value: 3,
},
b: {max: 100,
min: 0,
value: 90,
},
c: {max: 1,
min: -1,
},
};
var merge_out = {
a: 10,
b: 5,
c: 0,
d: 1000,
};
var o = JSUS.mergeOnKey(merge_in, merge_out, 'value');
it('should merge the second in the first object in the key value', function(){
o.d.should.exist;
o.c.value.should.exist;
o.a.value.should.be.eql(merge_out.a);
o.b.value.should.be.eql(merge_out.b);
o.c.value.should.be.eql(merge_out.c);
o.d.value.should.be.eql(merge_out.d);
});
it('modification to the merged object should affect any of the merging ones', function(){
checkClone(o, merge_in, merge_out);
});
});
});
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