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.
Range function (returns array of values in range).
Both es6 modules and common-js modules supported by default.
import {range} from 'fjl-range';
const testRange = [-3, -4, -5, 1, 2, 3, 99, 98, 97];
range(-3, -5, -1).concat(range(1, 3), range(99, 97, -1))
.every((x, ind) => x === testRange[ind]) === true // true
or
const {range} = require('fjl-range');
// ...
or use one of 'amd', 'umd', 'iife', or 'commonjs' builds included in './dist' folder: Example:
<!-- If imported globally ('iife') exported as `fjlRange` globally -->
<script src="js/vendor/fjl-range/dist/iife/fjl-range.js"></script>
Same as above or look/include files directly from './dist' folder for your module loading type (amd, umd, iife, commonjs, and/or module).
range(from, to, step = 1):Array<Number>
Returns an array of numbers generated from the given 'range' (from
-> to
) and step
values:
// Positve direction range
shallowCompare(range(1, 5), [1, 2, 3, 4, 5]) === true // true
shallowCompare(range(1, 5, 1), [1, 2, 3, 4, 5]) === true // true
// Negative numbers range
shallowCompare(range(-5, -1, 1), [-5, -4, -3, -2, -1]) === true // true
// Negative direction
shallowCompare(range(-3, -5, -1), [-3, -4, -5]) === true // true
// Auto normalize step for given range
shallowCompare(range$(-3, -5), [-3, -4, -5]) === true // true
// Note here that we are not passing a `step` and that the default `step` is `1`
// hence our step is invalid though this version of `range` normalizes
// the step for us if it is invalid. Also note that we are using `range$` here
// instead of `range` (for this functionality)
Haskell type: range :: Number a => a -> a -> a -> [a]
range$(from, to, step = 1):Array<Number>
Same as range
except normalizes step
variable to be valid; E.g.,
range$(-3, -5) // Still produces a valid range despite the default `step` being `1`
// This version of range looks at the `from` and `to` variables
// and checks if `from` is greater than `to` and if so return a negative version of step
// else does the opposite.
npm install
npm test
(after npm install
).JsDocs here: https://functional-jslib.github.io/fjl-range
GNU v2, v3
FAQs
Range function (returns array of values in range).
The npm package fjl-range receives a total of 3 weekly downloads. As such, fjl-range popularity was classified as not popular.
We found that fjl-range 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.