UNPKG

@extra-array/get-path

Version:

Gets value at path in a nested array.

11 lines (10 loc) 188 B
'use strict'; function is(v) { return Array.isArray(v); } function getPath(x, p) { for (var i of p) x = is(x) ? x[i] : undefined; return x; } module.exports = getPath;