notate
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

notate

Resolve dot notation strings

import { notate } from "notate";

const obj = {
	top_level: {
		nested: {
			value: "My Value",
		},
	},
};

notate(obj, "top_level.nested.value"); // 'My Value'
notate(obj, "top_level.missing.value"); // undefined

Resolve list notation as well

const obj = {
	list: [{ name: "Alice" }, { name: "Bob" }],
};
notate(obj, "list[1].name"); // 'Bob'

Readme

Keywords

none

Package Sidebar

Install

npm i notate

Weekly Downloads

2,032

Version

2.0.0

License

UNLICENSE

Unpacked Size

8.16 kB

Total Files

9

Last publish

Collaborators

  • omrilotan