Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@anselan/maprange
Advanced tools
Inspired by the map function in the creative coding framework Processing.
Differs from the following similar JS packages:
remap (value, inputRange, targetRange, clamp)
...where the parameters are:
value
: a numberinputRange
, targetRange
: arrays of exactly 2 elements each, i.e [min,max]
clamp
(optional; default false
): whether to constrain the result within the given target rangeProvide the range (inputMin
, inputMax
) that your value
is currently in, and specify a new range (outputMin
, outputMax
) and you'll get back a new value as per the target range.
npm install @anselan/remap
Then (depending on your environment):
import remap from 'remap`
...or:
const remap = require('remap`)
The value 0.5
in the range [0,1] should return as 50
in the range [0,100]:
const result = remap(0.5, [0,1], [0, 100]); // result === 50
// These could be coordinates in [0,1] range:
const x = 0.5;
const y = 0.8967;
// Assume a display of 1920x1080 pixels:
const px = remap(0.5, [0,1], [0,1920]);
const py = remap(0.8967, [0,1], [0,1080]);
console.log(px, py); // "960, 968.436"
FAQs
Map values from one range to another
The npm package @anselan/maprange receives a total of 24 weekly downloads. As such, @anselan/maprange popularity was classified as not popular.
We found that @anselan/maprange demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.