UNPKG

@extra-array/get-all

Version:
12 lines (11 loc) 250 B
'use strict'; function index(x, i = 0) { return i < 0 ? Math.max(x.length + i, 0) : Math.min(i, x.length); } function get(x, i) { return x[index(x, i)]; } function getAll(x, is) { return is.map(i => get(x, i)); } module.exports = getAll;