UNPKG

mindee

Version:

Mindee Client Library for Node.js

78 lines (77 loc) 2.73 kB
"use strict"; /* eslint-disable @typescript-eslint/naming-convention */ Object.defineProperty(exports, "__esModule", { value: true }); exports.FieldConfidence = void 0; /** * Confidence level of a field as returned by the V2 API. */ var FieldConfidence; (function (FieldConfidence) { FieldConfidence["Certain"] = "Certain"; FieldConfidence["High"] = "High"; FieldConfidence["Medium"] = "Medium"; FieldConfidence["Low"] = "Low"; })(FieldConfidence || (exports.FieldConfidence = FieldConfidence = {})); // eslint-disable-next-line @typescript-eslint/no-namespace (function (FieldConfidence) { /** * Converts a FieldConfidence value to an integer. * @param confidence The FieldConfidence value to convert * @returns Integer representation (Certain=4, High=3, Medium=2, Low=1) */ function toInt(confidence) { switch (confidence) { case FieldConfidence.Certain: return 4; case FieldConfidence.High: return 3; case FieldConfidence.Medium: return 2; case FieldConfidence.Low: return 1; default: throw new Error(`Unknown FieldConfidence value: ${confidence}`); } } FieldConfidence.toInt = toInt; /** * Checks if the first FieldConfidence is greater than the second. * @param a First FieldConfidence value * @param b Second FieldConfidence value * @returns true if a > b */ function greaterThan(a, b) { return toInt(a) > toInt(b); } FieldConfidence.greaterThan = greaterThan; /** * Checks if the first FieldConfidence is greater than or equal to the second. * @param a First FieldConfidence value * @param b Second FieldConfidence value * @returns true if a >= b */ function greaterThanOrEqual(a, b) { return toInt(a) >= toInt(b); } FieldConfidence.greaterThanOrEqual = greaterThanOrEqual; /** * Checks if the first FieldConfidence is less than the second. * @param a First FieldConfidence value * @param b Second FieldConfidence value * @returns true if a < b */ function lessThan(a, b) { return toInt(a) < toInt(b); } FieldConfidence.lessThan = lessThan; /** * Checks if the first FieldConfidence is less than or equal to the second. * @param a First FieldConfidence value * @param b Second FieldConfidence value * @returns true if a <= b */ function lessThanOrEqual(a, b) { return toInt(a) <= toInt(b); } FieldConfidence.lessThanOrEqual = lessThanOrEqual; })(FieldConfidence || (exports.FieldConfidence = FieldConfidence = {}));