2.0.0 • Published 6 years ago

alias-decorator v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

alias-decorator Build Status

Alias methods via an ES7 decorator

Installing

$ npm install alias-decorator

Usage

import alias from 'alias-decorator'

class Dog {
  @alias('bark', 'growl')
  speak () {
    console.log('woof')
  }
}

const dog = new Dog()
dog.speak === dog.bark // true
dog.bark === dog.growl // true

alias copies your property descriptor directly, so properties like enumerable are preserved.