1.0.0 • Published 5 years ago

@linxuekai/interface v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago
const Interface = require('@linxuekai/interface')
// or import Interface from '@linxuekai/interface' in ES6

let
  IMan = new Interface('Man', ['eat', 'work', 'sleep']),
  IStudent = new Interface('Student', ['read', 'write'])
  
man = {
  eat() { },
  work() { },
  // sleep() { },
  read() { },
  write() { }
}

Interface.ensureImplements(man, IMan, IStudent)
// Error: the method 'sleep' of Interface named 'Man' has not be implemented.