UNPKG

mindee

Version:

Mindee Client Library for Node.js

73 lines (72 loc) 2.9 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _PayslipV2PayPeriod_instances, _PayslipV2PayPeriod_printableValues; Object.defineProperty(exports, "__esModule", { value: true }); exports.PayslipV2PayPeriod = void 0; /** * Information about the pay period. */ class PayslipV2PayPeriod { constructor({ prediction = {} }) { _PayslipV2PayPeriod_instances.add(this); /** Confidence score */ this.confidence = 0.0; /** * Contains the relative vertices coordinates (points) of a polygon containing * the field in the document. */ this.polygon = []; this.endDate = prediction["end_date"]; this.month = prediction["month"]; this.paymentDate = prediction["payment_date"]; this.startDate = prediction["start_date"]; this.year = prediction["year"]; this.pageId = prediction["page_id"]; this.confidence = prediction["confidence"] ? prediction.confidence : 0.0; if (prediction["polygon"]) { this.polygon = prediction.polygon; } } /** * Default string representation. */ toString() { const printable = __classPrivateFieldGet(this, _PayslipV2PayPeriod_instances, "m", _PayslipV2PayPeriod_printableValues).call(this); return ("End Date: " + printable.endDate + ", Month: " + printable.month + ", Payment Date: " + printable.paymentDate + ", Start Date: " + printable.startDate + ", Year: " + printable.year); } /** * Output in a format suitable for inclusion in a field list. */ toFieldList() { const printable = __classPrivateFieldGet(this, _PayslipV2PayPeriod_instances, "m", _PayslipV2PayPeriod_printableValues).call(this); return ` :End Date: ${printable.endDate} :Month: ${printable.month} :Payment Date: ${printable.paymentDate} :Start Date: ${printable.startDate} :Year: ${printable.year}`.trimEnd(); } } exports.PayslipV2PayPeriod = PayslipV2PayPeriod; _PayslipV2PayPeriod_instances = new WeakSet(), _PayslipV2PayPeriod_printableValues = function _PayslipV2PayPeriod_printableValues() { return { endDate: this.endDate ?? "", month: this.month ?? "", paymentDate: this.paymentDate ?? "", startDate: this.startDate ?? "", year: this.year ?? "", }; };