0.0.1 • Published 3 years ago
tinypath v0.0.1
tinypath
A tiny utility for generating chains of object property paths.
Usage
import { getPaths } from 'tinypath'
getPaths({
root: 'root',
lvl1: {
propLvl1: 'propLvl1',
lvl2: {
propLvl2: 'propLvl1'
}
}
})
// =>
// {
// "root": "root",
// "lvl1": {
// "propLvl1": "lvl1.propLvl1",
// "lvl2": {
// "propLvl2": "lvl1.lvl2.propLvl2",
// "self": "lvl1.lvl2"
// },
// "self": "lvl1"
// }
// }
API: getPaths(object[, options])
object
: Objectoptions?
: TinyPathOptions
TinyPathOptions
depth?: number
Default: 0
base?: string
Default: ''
separator?: string
Default: '.'