Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
JavaScript "deep equality" / structural equality tester with Node.js flavor.
deeper
is a library for structurally comparing the equality of JavaScript
values. It supports recursive / cyclical data structures, is written to avoid
try / catch / throw (for speed), and has no dependencies by default.
If you're running Node 0.12+ or io.js, deeper
will use the built-in
Buffer.equals()
. If you're running an older version of Node and you install
Ben Noordhuis's
buffertools into a project
using deeper
, it will use that to speed up comparison of Buffers. This used
to be installed as an optional dependency, but it gets in the way of
browserification and also makes using deeper
in your own projects harder, so
I changed it to just try to use it if it's there.
It has some optimizations, but stresses correctness over raw speed (unless
you're testing objects with lots of Buffers attached to them, in which case it
plus buffertools
is likely to be the fastest general-purpose deep-comparison
tool available).
The core algorithm is based on those used by Node's assertion library and the implementation of cycle detection in isEqual in Underscore.js.
I like to think the documentation is pretty OK.
npm install deeper
// vanilla
var deepEqual = require('deeper')
if (!deepEqual(obj1, obj2)) console.log("yay! diversity!");
Copied from the source, here are the details of deeper
's algorithm:
===
only tests objects and functions by reference. null
is an object.
Any pairs of identical entities failing this test are therefore objects
(including null
), which need to be recursed into and compared attribute by
attribute.a
or b
is not an object, they're clearly not the same. All unfiltered a
and b
getting past this are objects (including null
).null
is an object, but null === null.
All unfiltered a
and b
are
non-null Objects
..getTime()
) than by
lexical value.RegExps
by their components, not the objects themselves.callee
, which you
shouldn't be looking at anyway.a
and b
are on the same constructor chain.a
and b
have the same number of own properties (which is
what Object.keys()
returns).BSD. Go nuts.
FAQs
JavaScript "deep equality" / structural equality tester with Node.js flavor.
The npm package deeper receives a total of 7,852 weekly downloads. As such, deeper popularity was classified as popular.
We found that deeper 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.