safer-get
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Safer get

npm Build Status Coverage Status npm bundle size

Small utility for accessing deep nested parameters in Typescript

Usage

  • safer(object: Object, ...keyArray: string[]) - Gets the value at path of object. keyArray is typed and has a maximum depth of 7.

Params

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')

Package Sidebar

Install

npm i safer-get

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

22.2 kB

Total Files

13

Last publish

Collaborators

  • rubenjimenez
  • engineering-foundernest
  • pexegouva
  • daniseijo