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.
Compare numbers, arrays, or nested arrays for equality up to some tolerance. Checks both shapes and values. Uses almost-equal and generalizes array-almost-equal. Useful when working with lists of coordinates and other numerical data.
use npm
npm install allclose
allclose(a, b, [atol], [rtol])
requires two numbers or arrays or nested arrays a
and b
, and optionally an absolute tolerance atol
and a relative tolerance rtol
. returns true
if a
and b
have the same shape and value, and false
otherwise.
you can test numbers
allclose(1, 1)
> true
allclose(1, 2)
> false
or arrays
allclose([1, 2], [1, 2])
> true
allclose([1, 2], [1, 2, 3])
> false
allclose([1, 2], [1, 3])
> false
or nested arrays
allclose([[1, 2], [3, 4]], [[1, 2], [3, 4]])
> true
allclose([[1, 2], [3, 4]], [[1, 2], [3, 4], [5, 6]])
> false
allclose([[1, 2], [3, 4]], [[1, 2], [3, 5]])
> false
and you can optionally specify a tolerance
allclose([1, 2], [1, 2.1])
> false
allclose([1, 2], [1, 2.1], 0.2)
> true
FAQs
compare numerical arrays
The npm package allclose receives a total of 0 weekly downloads. As such, allclose popularity was classified as not popular.
We found that allclose 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.