retrofit

0.2.11 • Public • Published

Retrofit

Dynamically extend classes

git clone git@github.com:invrs/retrofit.git
cd retrofit
npm install
npm test

Usage

let A = class {
  a() { console.log("A#a") }
}
 
let B = build(A, [
  [ /./, ({ args, fn, instance }) => {
    console.log("args", args)
    return fn.apply(instance, args)
  } ],
  [ "b", ({ args }) =>
    console.log("args", args)
  ]
])
 
new B().a("hello")
  // args ['hello']
  // A#a
 
new B().b("hello")
  // args ['hello']

Readme

Keywords

none

Package Sidebar

Install

npm i retrofit

Weekly Downloads

1

Version

0.2.11

License

MIT

Last publish

Collaborators

  • winton