1.0.0 • Published 2 years ago

path_to_target v1.0.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

A simple function that traverses an object

Pass the object and the keys (as strings) and the function return the value or undefined if it doesn't exist.

const pathToTarget = require('path_to_target');
const anObject = {hello: {world: ' hello earth'}};
const result = pathToTarget(anObject, ['hello', 'world']);
console.log(result);
//'hello earth'
1.0.0

2 years ago