dotfind

This package is used for searching through javascript objects. Providing a dot notaton of the falttened path and returned is the items within the depths of the object

Usage no npm install needed!

<script type="module">
  import dotfind from 'https://cdn.skypack.dev/dotfind';
</script>

README

This package is used to search through objects given a dot notation path of the route.

Examples:

const dotfind = require("dotfind");

const obj = {a: 5};
dotfind("a", obj); //5
const dotfind = require("dotfind");

const obj = {a: b: 5};
dotfind("a.b", obj); //5
const dotfind = require("dotfind");

const obj = {"a.b": 5};
dotfind("a.b", obj); //5
const dotfind = require("dotfind");

const obj = {a: {"b.c": 5}};
dotfind("a.b.c", obj); //5
const dotfind = require("dotfind");

const obj = {a: [{b: 5}]};
dotfind("a.0.b", obj); //5
dotfind("a[0].b", obj); //5