Skip to content
Subhajit Sahu edited this page Feb 3, 2021 · 26 revisions

Get values at indices.

Alternatives: get, getAll.
Similar: get, set, remove.


function getAll(x, is)
// x:  an iterable
// is: indices (sorted)
const xiterable = require('extra-iterable');

var x = [2, 4, 6, 8];
[...xiterable.getAll(x, [1, 2])];
// → [4, 6]

[...xiterable.getAll(x, [1, 3])];
// → [4, 8]


References

Clone this wiki locally