Operate objects via dot path.
pnpm i propathy
import { getProperty, setProperty, hasProperty, deleteProperty } from "propathy";
const target = { foo: { bar: [{ baz: "qux" }] } };
getProperty(target, "foo.bar[0].baz");
// "qux"
getProperty(target, "foo.bar[1]");
// undefined
setProperty(target, "foo.bar[0].baz", "kzr");
console.log(target);
// { foo: { bar: [{ baz: "kzr" }] } }
hasProperty(target, "foo.bar[0].baz");
// true
hasProperty(target, "foo.bar[1]");
// false
deleteProperty(target, "foo.bar[0].baz");
// true
console.log(target);
// { foo: { bar: [{}] } }