UNPKG

@extra-array/has-path

Version:

Checks if nested array has a path.

14 lines (13 loc) 225 B
'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;