m3g4p0p / alias-props

Specify aliases for object properties.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alias-props

Specify aliases for object properties.

Installation

yarn add alias-props

Usage

const aliasProps = require('alias-props')

const doSomething = options => {
  const {
    importantNote = 'Remember buying milk!',
    failSilently = false
  } = aliasProps(options, {
    importantNote: ['cleverComment', 'remarkableRemark'],
    failSilently: ['ignoreError']
  })

  // ...
}

doSomething({ ignoreError: true })

License

MIT

About

Specify aliases for object properties.


Languages

Language:JavaScript 100.0%