-
Notifications
You must be signed in to change notification settings - Fork 1
indexRange
Subhajit Sahu edited this page May 11, 2020
·
25 revisions
Gets index range of part of iterable. 🏃 📼 📦 🌔 📒
Similar: index, indexRange, length.
iterable.indexRange(x, [i], [I]);
// x: an iterable
// i: start index (-ve: from right) (0)
// I: end index (-ve: from right) (end)
// --> [start index, end index]
const iterable = require('extra-iterable');
var x = [2, 4, 6, 8];
iterable.indexRange(x, 1);
// [1, 4]
iterable.indexRange(x, 1, -1);
// [1, 3]
iterable.indexRange(x, 1, -10);
// [1, 1]