1.0.0 • Published 9 years ago

replace-constructor v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

replace-constructor

Replace/wrap a class constructor, while keeping the prototype, name and properties of the original class. Like extending a class, but suitable for use in decorators and such. Babel compatible. Adapted from autocreate - all credits to @pjeby.

npm status Dependency status

example

npm i replace-constructor

const replace = require('replace-constructor')

class Original {
  constructor(x, y) {
    // ..
  }
}

const Wrapped = replace(Original, function(x, y){
  Original.call(this, x, y)
})

install

With npm do:

npm install replace-constructor

license

MIT (permission pending) © Vincent Weevers, ISC © PJ Eby