abstract-function

1.0.1 • Public • Published

abstract-function

an abstract function that does nothing except throw an error when called.

Installation

npm install abstract-function

Example

var abstract = require('abstract-function');
 
// interface
var User = {
  login: abstract,
  register: abstract
}
 
// subclass
function UserRepo() {};
UserRepo.prototype = Object.create(User); // extend the User.
UserRepo.prototype.login = function() {
  console.log('do login');
}
 
var user = new UserRepo();
user.login(); // ok
user.register();  //throw not implement exception
 

License

MIT

Package Sidebar

Install

npm i abstract-function

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • quocnguyen