Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
object-locator
Advanced tools
Retrieve object inside an object my giving a path to the object, you no need to care for nulls/undefined
This small lib helps a developer to go directly inside object properties for any given depth and to return the datat
const obj = {a: {b: {c: 'd'}}};
// get a.b.c - verbose way
if(a && a.b && a.c)
return a.b.c
const locator = require('object-locator');
const obj = {a: {b: {c: 'd'}}};
// elegant way
locator(obj).a.b.c.getOrElse('bla') // === 'd'
// or for non exist object
locator(obj).a.b.not.exist.getOrElse('bla') // === 'bla'
$ npm install --save-dev object-locator
FAQs
Retrieve object inside an object my giving a path to the object, you no need to care for nulls/undefined
We found that object-locator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.