mindee
Version:
Mindee Client Library for Node.js
84 lines (83 loc) • 3.6 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 _PayslipV3Employee_instances, _PayslipV3Employee_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PayslipV3Employee = void 0;
const geometry_1 = require("../../../geometry");
/**
* Information about the employee.
*/
class PayslipV3Employee {
constructor({ prediction = {} }) {
_PayslipV3Employee_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 = new geometry_1.Polygon();
this.address = prediction["address"];
this.dateOfBirth = prediction["date_of_birth"];
this.firstName = prediction["first_name"];
this.lastName = prediction["last_name"];
this.phoneNumber = prediction["phone_number"];
this.registrationNumber = prediction["registration_number"];
this.socialSecurityNumber = prediction["social_security_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, _PayslipV3Employee_instances, "m", _PayslipV3Employee_printableValues).call(this);
return ("Address: " +
printable.address +
", Date of Birth: " +
printable.dateOfBirth +
", First Name: " +
printable.firstName +
", Last Name: " +
printable.lastName +
", Phone Number: " +
printable.phoneNumber +
", Registration Number: " +
printable.registrationNumber +
", Social Security Number: " +
printable.socialSecurityNumber);
}
/**
* Output in a format suitable for inclusion in a field list.
*/
toFieldList() {
const printable = __classPrivateFieldGet(this, _PayslipV3Employee_instances, "m", _PayslipV3Employee_printableValues).call(this);
return `
:Address: ${printable.address}
:Date of Birth: ${printable.dateOfBirth}
:First Name: ${printable.firstName}
:Last Name: ${printable.lastName}
:Phone Number: ${printable.phoneNumber}
:Registration Number: ${printable.registrationNumber}
:Social Security Number: ${printable.socialSecurityNumber}`.trimEnd();
}
}
exports.PayslipV3Employee = PayslipV3Employee;
_PayslipV3Employee_instances = new WeakSet(), _PayslipV3Employee_printableValues = function _PayslipV3Employee_printableValues() {
return {
address: this.address ?? "",
dateOfBirth: this.dateOfBirth ?? "",
firstName: this.firstName ?? "",
lastName: this.lastName ?? "",
phoneNumber: this.phoneNumber ?? "",
registrationNumber: this.registrationNumber ?? "",
socialSecurityNumber: this.socialSecurityNumber ?? "",
};
};