0.1.2 • Published 8 years ago

@c8/check-interface v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

@c8/check-interface

Super tiny lib on top of check-types npm package to check object interfaces

Installation

npm i @c8/check-interface

Usage

const checkInterface = require('@c8/check-interface')

class MyInterface {

  constructor () {
    checkInterface(this, ['foo', 'bar'])
  }
}

class Foo extends MyInterface {
  constructor () {
    super()
  }

  foo () {
    return
  }
}

let fooClass = new Foo() // will throw an Error as bar isn't implemented