UNPKG

mindee

Version:

Mindee Client Library for Node.js

24 lines (23 loc) 905 B
import { Inference, Page } from "../../../v1/parsing/common/index.js"; import { InvoiceV4Document } from "./invoiceV4Document.js"; /** * Invoice API version 4 inference prediction. */ export class InvoiceV4 extends Inference { constructor(rawPrediction) { super(rawPrediction); /** The endpoint's name. */ this.endpointName = "invoices"; /** The endpoint's version. */ this.endpointVersion = "4"; /** The document's pages. */ this.pages = []; this.prediction = new InvoiceV4Document(rawPrediction["prediction"]); rawPrediction["pages"].forEach((page) => { if (page.prediction !== undefined && page.prediction !== null && Object.keys(page.prediction).length > 0) { this.pages.push(new Page(InvoiceV4Document, page, page["id"], page["orientation"])); } }); } }