Skip to content
Subhajit Sahu edited this page May 10, 2020 · 17 revisions

Gets values from middle. 🏃 [:vhs:] 📦 🌔

Similar: left, middle, right.

iterable.middle(x, [i], [n]);
// x: an iterable
// i: start index (0)
// n: number of values (1)
const iterable = require('extra-iterable');

var x = [1, 2, 3];
[...iterable.middle(x, 1, 1)];
// [ 2 ]

[...iterable.middle(x, 1, 2)];
// [ 2, 3 ]

references

Clone this wiki locally