Skip to content

Subash/object-path

Repository files navigation

Installation

npm install --save @sbspk/object-path

Usage

import { get, set, unset } from "@sbspk/object-path";

const data = {
  inner: {
    a: "b",
  },
};

get(data, "inner.a"); // returns b
set(data, "inner.a", "c"); // sets the value to c
unset(data, "inner.a"); // removes a and inner because inner becomes empty after unsetting a
set(data, "hello.world", { greeting: "Namaste" }); // sets data.hello.world.greeting
get(data, "hello.world.greeting"); // returns 'Namaste'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published