object-take
A really small library, almost 150 bytes minified and gzipped, to take value from object using a string for path expression or returns a placeholder if value is undefined or unreachable.
It's approach is based on idx, from Facebook, and a insight from Vue.js meetup where @IgorHalfeld shows a way to get a property using eval. Yeah, eval.
Install
This module is published under NPM registry, so you can install from any package manager.
npm install --save object-take # If you're using Yarn use the command below. yarn add object-take
Usage
Just import take function and take a value from object using a path expression.
; // ... const name = ;
You can use brackets, even on first property.
const title = ;
Also, expressions could be attached to path.
const id = ;
License
Released under the MIT License.