UNPKG

opencart-manager

Version:

Node.js package helping to manage your opencart store data easily.

26 lines (25 loc) 915 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = __importDefault(require("../errors")); class FakeEntity { constructor(model, ...rest) { this.model = model; this.data = {}; this.description = {}; } setData(newData) { this.data = Object.assign(Object.assign({}, this.data), newData); return this; } setDescription(newDesc) { if (!newDesc.languageId) throw new Error(errors_1.default.NOT_SPECIFIED("newDesc.languageId")); const langId = newDesc.languageId; this.description[langId] = Object.assign(Object.assign({}, this.description[langId]), newDesc); return this; } } exports.default = FakeEntity;