Small utility for accessing deep nested parameters in Typescript
safer(object: Object, ...keyArray: string[])- Gets the value at path of object.keyArrayis typed and has a maximum depth of 7.
| Option | Description | Default Value |
|---|---|---|
object |
Base object to access the values | undefined |
keyArray |
Array of paths to the desired value. It is typed and has a maximum depth of 7. | undefined |
import { safer } from 'safer-get'
const data = { its: { really: { super: { nested: undefined } } } }
const result = safer(data, 'its', 'really', 'super', 'nested')