UNPKG

postel-ita

Version:

Library to create files compatible with italian Poste Postel system

46 lines 1.55 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Lang_1 = __importDefault(require("./Lang")); class Address { constructor({ ...opt }) { this.header = 'Spett.le'; this.nominativo = ''; this.indirizzo = ''; this.civico = ''; this.localita = ''; this.cap = ''; this.comune = ''; this.provincia = ''; this.id = '000000'; this.fiscalCode = ''; this.header = opt.header ?? this.header; this.nominativo = opt.nominativo; this.indirizzo = opt.indirizzo; this.civico = opt.civico; this.localita = opt.localita ?? this.localita; this.cap = opt.cap; this.comune = opt.comune; this.provincia = opt.provincia; this.id = opt.id; this.fiscalCode = opt.fiscalCode; } result({ where }) { const rows = []; if (where === 'missive') rows.push(this.header); rows.push(this.nominativo); rows.push(this.indirizzo + ', ' + this.civico + (this.localita === '' ? '' : ` - ${this.localita}`)); rows.push(`${this.cap} ${this.comune} ${this.provincia}`); if (where === 'form') rows.push(`ID: ${this.id}`); return rows.join(Lang_1.default.EOL); } } exports.default = Address; //# sourceMappingURL=Address.js.map