UNPKG

awv-api

Version:
35 lines (34 loc) 998 B
'use strict'; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var FieldHelper_1 = __importDefault(require("../helper/FieldHelper")); /** * City class * * @class City */ var City = /** @class */ (function () { function City(id, label, value) { this.id = id; this.label = label; this.value = value; this.streets = []; if (!this.isValid()) { throw new Error('City is not valid!'); } } City.prototype.setStreets = function (streets) { this.streets = streets; }; City.prototype.getStreets = function () { return this.streets; }; City.prototype.isValid = function () { return (!isNaN(this.id) && FieldHelper_1.default.hasNotEmptyStringFields(this, 'label', 'value')); }; return City; }()); exports.default = City;