UNPKG

mindee

Version:

Mindee Client Library for Node.js

28 lines (27 loc) 912 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrientationField = void 0; const standard_1 = require("../standard"); /** * The clockwise rotation to apply (in degrees) to make the image upright. */ class OrientationField extends standard_1.BaseField { /** * @param {OrientationFieldConstructor} constructor Constructor parameters. */ constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId, }) { super({ prediction, valueKey, reconstructed }); const orientations = [0, 90, 180, 270]; this.pageId = pageId; this.value = parseInt(prediction[valueKey]); if (!orientations.includes(this.value)) this.value = 0; } /** * Default string representation. */ toString() { return `${this.value} degrees`; } } exports.OrientationField = OrientationField;