mindee
Version:
Mindee Client Library for Node.js
74 lines (73 loc) • 3 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 _UsMailV3SenderAddress_instances, _UsMailV3SenderAddress_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsMailV3SenderAddress = void 0;
const geometry_1 = require("../../../geometry");
/**
* The address of the sender.
*/
class UsMailV3SenderAddress {
constructor({ prediction = {} }) {
_UsMailV3SenderAddress_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.city = prediction["city"];
this.complete = prediction["complete"];
this.postalCode = prediction["postal_code"];
this.state = prediction["state"];
this.street = prediction["street"];
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, _UsMailV3SenderAddress_instances, "m", _UsMailV3SenderAddress_printableValues).call(this);
return ("City: " +
printable.city +
", Complete Address: " +
printable.complete +
", Postal Code: " +
printable.postalCode +
", State: " +
printable.state +
", Street: " +
printable.street);
}
/**
* Output in a format suitable for inclusion in a field list.
*/
toFieldList() {
const printable = __classPrivateFieldGet(this, _UsMailV3SenderAddress_instances, "m", _UsMailV3SenderAddress_printableValues).call(this);
return `
:City: ${printable.city}
:Complete Address: ${printable.complete}
:Postal Code: ${printable.postalCode}
:State: ${printable.state}
:Street: ${printable.street}`.trimEnd();
}
}
exports.UsMailV3SenderAddress = UsMailV3SenderAddress;
_UsMailV3SenderAddress_instances = new WeakSet(), _UsMailV3SenderAddress_printableValues = function _UsMailV3SenderAddress_printableValues() {
return {
city: this.city ?? "",
complete: this.complete ?? "",
postalCode: this.postalCode ?? "",
state: this.state ?? "",
street: this.street ?? "",
};
};