1.0.1 • Published 6 years ago

abstract-function v1.0.1

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

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

1.0.1

6 years ago

1.0.0

6 years ago