https://github.com/shimohq/resolve-keypath
Resolve the value of an object according the keypath
https://github.com/shimohq/resolve-keypath
Last synced: 6 months ago
JSON representation
Resolve the value of an object according the keypath
- Host: GitHub
- URL: https://github.com/shimohq/resolve-keypath
- Owner: shimohq
- License: mit
- Created: 2015-12-12T15:42:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-13T05:46:40.000Z (almost 10 years ago)
- Last Synced: 2025-03-16T20:48:26.440Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# resolve-keypath
[](https://travis-ci.org/shimohq/resolve-keypath)
## Install
```
npm install resolve-keypath
```## Usage
```javascript
var resolve = require('resolve-keypath');resolve({ a: { b: 1 } }, 'a.b') // 1
resolve({ a: { b: 1 } }, 'a/b', '/') // 1
resolve(null, 'a') // null// Use `resolver` if you want to cache the result per object:
var resolver = resolve.resolver;var myResolver = resolver({ a: { b: 1 }}, '/');
myResolver('a/b') // 1
```# License
MIT