Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
better-objects
Advanced tools
Adds the following methods to Object.prototype:
You can choose not to add the methods to the Object prototype, it's really simple to change
$ npm install better-objects
require('better-objects');
//or just
<script src="node_modules/better-objects/index.js"></script>
var object = { ... };
var clone = object.clone();
// or with arrays
var arr = [...];
var clone = arr.clone();
var objOne = {
"string": "some value",
"number": 344,
"boolean": true,
"object": {
a: 10,
b: 20
},
"array": [0, 1, 2, 3, 4, 5],
"superArray": [
"string",
1,
true,
["an", "array", "of", "strings"],
{
"str": "dfsdfh",
"fn": somefunction,
"array": [1, 3, 4, 5, 6]
}
]
};
var objTwo = {
"string": "some value",
"number": 344,
"boolean": true,
"object": {
a: 10,
b: 20
},
"array": [0, 1, 2, 3, 4, 5],
"superArray": [
"string",
1,
true,
["an", "array", "of", "strings"],
{
"str": "dfsdfh",
"fn": somefunction,
"array": [1, 3, 4, 5, 6]
}
]
};
var objThree = {
something: 'different'
}
objOne.equals(objTwo); // returns true
objTwo.equals(objOne); // rerturns true
objOne.equals(objThree); // returns false
objThree.equals(objTwo); // returns false
if( fn1.toString() === fn2.toString() ) { equals = true };
if you wish to have strict equality, just change it to:
if( fn1 === fn2 ) { equals = true };
I'm using Testem + Mocha + Chai
$ npm install -g testem
$ npm install
# run the tests
$ testem
FAQs
Clone and Equals methods for javascript objects and arrays
The npm package better-objects receives a total of 2 weekly downloads. As such, better-objects popularity was classified as not popular.
We found that better-objects demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.