@c8/check-interface

0.1.2 • Public • Published

@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

/@c8/check-interface/

    Package Sidebar

    Install

    npm i @c8/check-interface

    Weekly Downloads

    2

    Version

    0.1.2

    License

    MIT

    Last publish

    Collaborators

    • njo_c8
    • c8deploy
    • brooksyd2
    • unlucio