mindee
Version:
Mindee Client Library for Node.js
68 lines (67 loc) • 2.71 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 _BillOfLadingV1Shipper_instances, _BillOfLadingV1Shipper_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BillOfLadingV1Shipper = void 0;
/**
* The party responsible for shipping the goods.
*/
class BillOfLadingV1Shipper {
constructor({ prediction = {} }) {
_BillOfLadingV1Shipper_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.email = prediction["email"];
this.name = prediction["name"];
this.phone = prediction["phone"];
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, _BillOfLadingV1Shipper_instances, "m", _BillOfLadingV1Shipper_printableValues).call(this);
return ("Address: " +
printable.address +
", Email: " +
printable.email +
", Name: " +
printable.name +
", Phone: " +
printable.phone);
}
/**
* Output in a format suitable for inclusion in a field list.
*/
toFieldList() {
const printable = __classPrivateFieldGet(this, _BillOfLadingV1Shipper_instances, "m", _BillOfLadingV1Shipper_printableValues).call(this);
return `
:Address: ${printable.address}
:Email: ${printable.email}
:Name: ${printable.name}
:Phone: ${printable.phone}`.trimEnd();
}
}
exports.BillOfLadingV1Shipper = BillOfLadingV1Shipper;
_BillOfLadingV1Shipper_instances = new WeakSet(), _BillOfLadingV1Shipper_printableValues = function _BillOfLadingV1Shipper_printableValues() {
return {
address: this.address ?? "",
email: this.email ?? "",
name: this.name ?? "",
phone: this.phone ?? "",
};
};