@extra-map/has-path

Checks if nested map has a path. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraMapHasPath from 'https://cdn.skypack.dev/@extra-map/has-path';
</script>

README

Checks if nested map has a path. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: hasPath, getPath, setPath$, removePath$.

This is part of package extra-map.


map.hasPath(x, p);
// x: a nested map
// p: path
const map = require("extra-map");

var x = new Map([["a", 2], ["b", 4], ["c", 6]]);
var y = new Map([["x", x], ["e", 10], ["f", 12]]);
map.hasPath(y, ["e"]);
// true

map.hasPath(y, ["x", "b"]);
// true

map.hasPath(y, ["x", "b", "c"]);
// false


References