@extra-iterable/index-range

Gets index range of part of iterable.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-iterable/index-range
512.5.222 years ago3 years agoMinified + gzip package size for @extra-iterable/index-range in KB

Readme

Gets index range of part of iterable. :package: :smileycat: :running: :vhs: :moon: :scroll: :newspaper: :bluebook:
Similar: index, indexRange, size, isEmpty.

This is part of package extra-iterable.



iterable.indexRange(x, [i], [I]);
// x: an iterable
// i: start index (-ve: from right) (0)
// I: end index (-ve: from right) (X)
// → [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]



References