On GitHub, jonschlinkert/get-value has picked up 307 stars, Backend, TypeScript. Use property paths (`a.b.c`) get a nested value from an object.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Use property paths like 'a.b.c' to get a nested value from an object. Even works when keys have dots in them (no other dot-prop library we tested does this, or does it correctly).
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Slightly improves performance by passing an array of strings to use as object path segments (this is also useful when you need to dynamically build up the path segments):
Custom function to use for splitting the string into object path segments.
const obj = { 'a.b': { c: { d: 'e' } } };
// example of using a string to split the object path
const options = { split: path => path.split('/') };
console.log(getValue(obj, 'a.b/c/d', options)); //=> 'e'
// example of using a regex to split the object path
// (removing escaped dots is unnecessary, this is just an example)
const options = { split: path => path.split(/\\?\./) };
console.log(getValue(obj, 'a\\.b.c.d', options)); //=> 'e'
options.separator
Type: string|regex
Default: .
The separator to use for splitting the string (this is probably not needed when options.split is used).
Customize how the object path is created when iterating over path segments.
const obj = { 'a/b': { c: { d: 'e' } } };
const options = {
// when segs === ['a', 'b'] use a "/" to join, otherwise use a "."
join: segs => segs.join(segs[0] === 'a' ? '/' : '.')
};
console.log(getValue(obj, 'a.b.c.d', options));
//=> 'e'
options.joinChar
Type: string
Default: .
The character to use when re-joining the string to check for keys with dots in them (this is probably not needed when options.join is used). This can be a different value than the separator, since the separator can be a string or regex.
Adds support for Map-like objects, allowing objects with a get method that can be used to retrieve values by key.
Removed outdated travis config, and added GitHub Actions workflow for running tests.
v4.0.0
Refactored to TypeScript
Added support for handling deep property paths with arrays
Improved performance on large nested objects
Fixed edge case issues with keys containing special characters.
Updated benchmarks
Updated documentation to reflect new features and bug fixes.
v3.0.0
Improved support for escaping. It's no longer necessary to use backslashes to escape keys.
Adds options.default for defining a default value to return when no value is resolved.
Adds options.isValid to allow the user to check the object after each iteration.
Adds options.separator for customizing character to split on.
Adds options.split for customizing how the object path is split.
Adds options.join for customizing how the object path is joined when iterating over path segments.
Adds options.joinChar for customizing the join character.
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
How active is development on jonschlinkert/get-value?
The most recent commit recorded on jonschlinkert/get-value was 5 months ago, based on the GitHub push timestamp. The repository has 23 forks — one of the better signals of community interest.
Is jonschlinkert/get-value open source?
Yes — jonschlinkert/get-value ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/jonschlinkert/get-value.
What license does jonschlinkert/get-value use?
jonschlinkert/get-value is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
What topics is jonschlinkert/get-value associated with?
Where can I see jonschlinkert/get-value in action?
The project maintains a homepage at https://github.com/jonschlinkert. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about jonschlinkert/get-value?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/jonschlinkert/get-value is the definitive source.
Read full README in the tab above.
Curious whether get-value is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about get-value.