UNPKG

mindee

Version:

Mindee Client Library for Node.js

70 lines (69 loc) 2.98 kB
"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 _ResumeV1SocialNetworksUrl_instances, _ResumeV1SocialNetworksUrl_printableValues; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResumeV1SocialNetworksUrl = void 0; const common_1 = require("../../parsing/common"); const geometry_1 = require("../../geometry"); /** * The list of social network profiles of the candidate. */ class ResumeV1SocialNetworksUrl { constructor({ prediction = {} }) { _ResumeV1SocialNetworksUrl_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.name = prediction["name"]; this.url = prediction["url"]; 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, _ResumeV1SocialNetworksUrl_instances, "m", _ResumeV1SocialNetworksUrl_printableValues).call(this); return ("Name: " + printable.name + ", URL: " + printable.url); } /** * Output in a format suitable for inclusion in an rST table. */ toTableLine() { const printable = __classPrivateFieldGet(this, _ResumeV1SocialNetworksUrl_instances, "m", _ResumeV1SocialNetworksUrl_printableValues).call(this); return ("| " + printable.name.padEnd(20) + " | " + printable.url.padEnd(50) + " |"); } } exports.ResumeV1SocialNetworksUrl = ResumeV1SocialNetworksUrl; _ResumeV1SocialNetworksUrl_instances = new WeakSet(), _ResumeV1SocialNetworksUrl_printableValues = function _ResumeV1SocialNetworksUrl_printableValues() { return { name: this.name ? this.name.length <= 20 ? (0, common_1.cleanSpecialChars)(this.name) : (0, common_1.cleanSpecialChars)(this.name).slice(0, 17) + "..." : "", url: this.url ? this.url.length <= 50 ? (0, common_1.cleanSpecialChars)(this.url) : (0, common_1.cleanSpecialChars)(this.url).slice(0, 47) + "..." : "", }; };