mindee
Version:
Mindee Client Library for Node.js
83 lines (82 loc) • 3.33 kB
JavaScript
"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 _PayslipV2Employer_instances, _PayslipV2Employer_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PayslipV2Employer = void 0;
/**
* Information about the employer.
*/
class PayslipV2Employer {
constructor({ prediction = {} }) {
_PayslipV2Employer_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.address = prediction["address"];
this.companyId = prediction["company_id"];
this.companySite = prediction["company_site"];
this.nafCode = prediction["naf_code"];
this.name = prediction["name"];
this.phoneNumber = prediction["phone_number"];
this.urssafNumber = prediction["urssaf_number"];
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, _PayslipV2Employer_instances, "m", _PayslipV2Employer_printableValues).call(this);
return ("Address: " +
printable.address +
", Company ID: " +
printable.companyId +
", Company Site: " +
printable.companySite +
", NAF Code: " +
printable.nafCode +
", Name: " +
printable.name +
", Phone Number: " +
printable.phoneNumber +
", URSSAF Number: " +
printable.urssafNumber);
}
/**
* Output in a format suitable for inclusion in a field list.
*/
toFieldList() {
const printable = __classPrivateFieldGet(this, _PayslipV2Employer_instances, "m", _PayslipV2Employer_printableValues).call(this);
return `
:Address: ${printable.address}
:Company ID: ${printable.companyId}
:Company Site: ${printable.companySite}
:NAF Code: ${printable.nafCode}
:Name: ${printable.name}
:Phone Number: ${printable.phoneNumber}
:URSSAF Number: ${printable.urssafNumber}`.trimEnd();
}
}
exports.PayslipV2Employer = PayslipV2Employer;
_PayslipV2Employer_instances = new WeakSet(), _PayslipV2Employer_printableValues = function _PayslipV2Employer_printableValues() {
return {
address: this.address ?? "",
companyId: this.companyId ?? "",
companySite: this.companySite ?? "",
nafCode: this.nafCode ?? "",
name: this.name ?? "",
phoneNumber: this.phoneNumber ?? "",
urssafNumber: this.urssafNumber ?? "",
};
};