Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

damianc/obj-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

ObjPath

Getting object property by a path string.

Installation

npm i @damianc/obj-path

Use

const obj = {
 foo: {
 bar: [10, 20, 30, 40]
 }
}
ObjPath(obj, 'foo.bar[1]')
// 20
const obj = {
 foo: {
 bar: [
 120,
 { baz: [{
 quux: 200
 }] }
 ]
 }
};
ObjPath(obj, 'foo.bar[1].baz[0].quux')
// 200
const obj = {
 foo: [1, 2, [3, 4]]
};
ObjPath(obj, 'foo[2][0]')
// 3

About

Getting object property by a path string.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /