-
Notifications
You must be signed in to change notification settings - Fork 1
indexRange
Subhajit Sahu edited this page Feb 3, 2021
·
25 revisions
Get index range for part of iterable.
Similar: index, indexRange, size, isEmpty.
function indexRange(x, i, I)
// x: an iterable
// i: start index (-ve: from right) [0]
// I: end index (-ve: from right) [END]
const xiterable = require('extra-iterable');
var x = [2, 4, 6, 8];
xiterable.indexRange(x, 1);
// → [1, 4]
xiterable.indexRange(x, 1, -1);
// → [1, 3]
xiterable.indexRange(x, 1, -10);
// → [1, 1]