UNPKG
@extra-array/get-path
Version:
latest (2.10.19)
2.10.19
2.10.18
2.10.17
2.10.16
2.10.15
2.10.14
2.10.13
2.10.12
2.10.11
2.10.10
2.10.9
2.10.8
2.10.7
2.10.6
2.10.5
Gets value at path in a nested array.
github.com/nodef/extra-array
nodef/extra-array
@extra-array/get-path
/
index.js
11 lines
(10 loc)
•
188 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
'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;