
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Various transforms for ranges of array/list indices. [npm search keywords: bounds confine enumerate index indexes map modulo translate validate warp]
Various transforms for ranges of array/list indices.
see test/usage.js
var arraynge = require('arraynge');
range = arraynge();
range = arraynge(from, upto); // range includes both values
range = arraynge(from, upto, list);
makeRangeFromList = arraynge.withThisList.bind(list);
range = makeRangeFromList(from, upto);
list.makeRange = arraynge.withThisList;
range = list.makeRange(from, upto);
The config functions return the arraynge they were called on, so you can chain them.
range.bounds(newFirstIndex, newLastIndex);
range.from(newFirstIndex);
range.upto(newLastIndex);
range.list(null || false); // forget current list
range.list(someObject); // set new list
range.list(someNumber); // set list to object { length: someNumber }
range.toString(); // -> (string) description
range.bounds(); // -> (array) [from, upto]
range.from(); // -> (any) from
range.upto(); // -> (any) upto
range.list(); // -> (object | false) list
range.len(); // -> (number) list.length or 0
Parameter max
or len
is optional. If provided, it should be a number.
(Maximum valid integer index for your list, or the list's length.)
If not provided or undefined
, it is calculated from .len()
.
range.trueMax(max); // index === true? set to max.
range.warpZero(len); // index negative? += len. still neg? set to false.
range.modulo(len); // warp indices into range [0 <= x < len]
range.confine(max); // index negative? set to 0. too large? set to max.
range.validateBounds(max); // negative or too large? set to false.
range.translate(bothDist); // add same offset to both
range.translate(fromDist, lastDist); // add offsets to each
false
.len
or max
optional as above.range.boundsIfValid(max); // array [from, upto]
range.enumerate(); // array of numbers {from <= x <= upto}, step size = 1
range.map(iter); // numbers like .enumerate but collect iter(list[x], x)
ISC
FAQs
Various transforms for ranges of array/list indices. [npm search keywords: bounds confine enumerate index indexes map modulo translate validate warp]
The npm package arraynge receives a total of 2 weekly downloads. As such, arraynge popularity was classified as not popular.
We found that arraynge 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.