@sbspk/object-path
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

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'

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i @sbspk/object-path

    Weekly Downloads

    0

    Version

    5.0.0

    License

    MIT

    Unpacked Size

    4.29 kB

    Total Files

    5

    Last publish

    Collaborators

    • sbspk