npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

@vltpkg/dot-prop

1.0.0-rc.13

@GitHub Actions

npmHomeRepoSnykSocket
Downloads:4822
$ npm install @vltpkg/dot-prop
DailyWeeklyMonthlyYearly

dot-prop

@vltpkg/dot-prop

A library that allows you to easily access, set, delete, and check deeply nested properties in objects and arrays using string-based paths.

Usage

const obj = { foo: { bar: [1, 2, 3] } }

// Get a value
get(obj, 'foo.bar[0]') // 1

// Set a value
set(obj, 'foo.bar[1]', 42) // obj.foo.bar[1] is now 42

// Delete a value
del(obj, 'foo.bar[2]') // Removes obj.foo.bar[2]

// Check if a path exists
has(obj, 'foo.bar[0]') // true