UNPKG
@extra-array/has-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
Checks if nested array has a path.
github.com/nodef/extra-array
nodef/extra-array
@extra-array/has-path
/
index.js
14 lines
(13 loc)
•
225 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict'
;
function
is
(
v
) {
return
Array
.
isArray
(v); }
function
hasPath
(
x, p
) {
for
(
var
i
of
p) {
if
(!
is
(x))
return
false
; x = x[i]; }
return
true
; }
module
.
exports
= hasPath;