UNPKG

howsmydriving-nyc

Version:
51 lines (50 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Fine data for a response var FineData = /** @class */ (function () { /* constructor( total_fined: string, total_paid: string, total_reduced: string, total_outstanding: string ) { this.total_fined = total_fined; this.total_outstanding = total_outstanding; this.total_paid = total_paid; this.total_reduced = total_reduced; }*/ function FineData(fine_data) { this.FINE_FIELDS = ['fined', 'reduced', 'paid', 'outstanding']; this.fined = 0.0; this.outstanding = 0.0; this.paid = 0.0; this.reduced = 0.0; this.total_fined = fine_data.total_fined; this.total_outstanding = fine_data.total_outstanding; this.total_paid = fine_data.total_paid; this.total_reduced = fine_data.total_reduced; } FineData.prototype.fines_assessed = function () { var _this = this; var fine_found = false; this.FINE_FIELDS.forEach(function (field) { if (_this[field] > 0.0) { fine_found = true; return fine_found; } }); return fine_found; }; FineData.prototype.max_amount = function () { var _this = this; var max_fine = 0.0; this.FINE_FIELDS.forEach(function (field) { if (_this[field] > max_fine) { max_fine = _this[field]; } }); return max_fine; }; return FineData; }()); exports.FineData = FineData;