Skip to content

interface/abstract function that does nothing except throw an error when called. Useful for programing to interface style.

License

Notifications You must be signed in to change notification settings

quocnguyen/abstract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

interface/abstract function that does nothing except throw an error when called. Useful for programing to interface style.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages