UNPKG

mindee

Version:

Mindee Client Library for Node.js

39 lines (38 loc) 1.28 kB
import { StringDict } from "../common"; /** * @property {object} prediction - Prediction object from HTTP response. * @property {string} valueKey - Key to use in the prediction dict. * @property {boolean} reconstructed - Is the object reconstructed (not extracted by the API). * @property {number} pageId - Page ID for multi-page document. */ export interface BaseFieldConstructor { prediction: StringDict; valueKey?: string; reconstructed?: boolean; pageId?: number; } /** * Base class for most fields. */ export declare class BaseField { /** The value. */ value?: string | number | boolean; /** `true` when the field was reconstructed or computed using other fields. */ reconstructed: boolean; /** Page ID for multi-page document. */ pageId?: number; /** * @param {BaseFieldConstructor} constructor Constructor parameters. */ constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor); compare(other: BaseField): boolean; /** * @param {BaseField[]} array - Array of Fields * @returns {number} Sum of all the Fields values in the array */ static arraySum(array: BaseField[]): number; /** * Default string representation. */ toString(): string; }