UNPKG

base-domain

Version:

simple module to help build Domain-Driven Design

69 lines (43 loc) 1.27 kB
var Base, hyphenize; hyphenize = require('./util').hyphenize; /** parent class of model, factory and repository. gives them @getFacade() method. @class Base @module base-domain */ Base = (function() { function Base() {} /** get facade the implementation is in Facade#requre() @method getFacade @static @return {Facade} */ Base.getFacade = function() { throw new Error("Facade is not created yet, or you required domain classes not from Facade.\nRequire domain classes by facade.getModel(), facade.getFactory(), facade.getRepository()\nto attach them getFacade() method."); }; /** get facade the implementation is in Facade#requre() @method getFacade @return {Facade} */ Base.prototype.getFacade = function() { throw new Error("Facade is not created yet, or you required domain classes not from Facade.\nRequire domain classes by facade.getModel(), facade.getFactory(), facade.getRepository()\nto attach them getFacade() method."); }; /** ClassName -> class-name the name must compatible with file name @method getName @public @static @return {String} */ Base.getName = function() { return hyphenize(this.name); }; return Base; })(); module.exports = Base;