node-web-mvc
Version:
node spring mvc
39 lines (38 loc) • 971 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class ModelAndViewContainer {
constructor() {
this.redirect = {};
}
isViewReference() {
return typeof this.view == 'string';
}
get model() {
return this.redirect;
}
addAttribute(name, value) {
if (!value)
return;
this.model[name] = value;
}
addAllAttributes(attributes) {
if (!attributes)
return;
Object.keys(attributes).forEach((key) => {
this.model[key] = attributes[key];
});
}
containAttribute(name) {
return name in this.model;
}
mergeAttributes(attributes) {
if (!attributes)
return;
Object.keys(attributes).forEach((key) => {
if (!this.containAttribute(key)) {
this.model[key] = attributes[key];
}
});
}
}
exports.default = ModelAndViewContainer;