Iterable item selection for JavaScript. See docs.
⚠️ Depending on your environment, the code may requireregeneratorRuntime
to be defined, for instance by importing regenerator-runtime/runtime.
import {first, last, nth} from '@iterable-iterator/select';
import {range} from '@iterable-iterator/range';
first(range(10)); // 0
last(range(10)); // 9
nth(range(10), 0); // 0
nth(range(10), -1); // 9
nth(range(10), -3); // 7