himself65 / class-callable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

class-callable

make class callable

npm version Build Status

USAGE

yarn add class-callable
class A extends Callable {
  constructor (props) {
    super('__call__')
  }

  __call__ () {
    return 'called'
  }
}

class B extends Callable {
  __call__ () {
    return 'called'
  }
}

class C extends Callable {
  constructor () {
    super(function () {
      return 'called'
    })
  }
}

const a = new A()
a()
// 'called'
const b = new B()
b()
// 'called'
const c = new C()
c()
// 'called'

LICENSE

Follow MIT LICENSE

About


Languages

Language:JavaScript 100.0%