Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

key-accessor

1.0.4 • Public • Published

key-accessor

access a key of object safely

Install

 
npm i key-accessor --save
 

Usage

import keyAccessor from 'key-accessor'
 
const music = {
  rock: {
    band: 'G N\' R'
  },
  pop: {
 
  }
}
 
const obj = keyAccessor(music)
 
obj.rock.band() // output: G N' R
obj.pop.band() // output: undefined
obj.classical.band() // output: undefined
 

Note

NOT support IE, since depending on Proxy object (ES6)

Install

npm i key-accessor

DownloadsWeekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

4.7 kB

Total Files

9

Last publish

Collaborators

  • avatar