1.0.0 • Published 5 years ago
json-data-paths v1.0.0
JSON DATA PATHS
Easily extract complete paths to every property in an object.
Created for use with Simple Object Path
const jsonDataPaths = require('./index')
const obj = {animal:
{
type: 'Feline',
dailyNeeds: [
{timeOfDay: 'morning', need: 'Breakfast'},
{timeOfDay: 'evening', need: 'Dinner'}
]
}
}
const paths = jsonDataPaths(obj)
/*
[ 'animal',
'animal/type',
'animal/dailyNeeds',
'animal/dailyNeeds/0',
'animal/dailyNeeds/0/timeOfDay',
'animal/dailyNeeds/0/need',
'animal/dailyNeeds/1',
'animal/dailyNeeds/1/timeOfDay',
'animal/dailyNeeds/1/need' ]
*/
1.0.0
5 years ago