UNPKG

mindee

Version:

Mindee Client Library for Node.js

66 lines (65 loc) 2.77 kB
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; import { cleanSpecialChars } from "../../../v1/parsing/common/index.js"; import { Polygon } from "../../../geometry/index.js"; /** * The list of social network profiles of the candidate. */ export 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 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) + " |"); } } _ResumeV1SocialNetworksUrl_instances = new WeakSet(), _ResumeV1SocialNetworksUrl_printableValues = function _ResumeV1SocialNetworksUrl_printableValues() { return { name: this.name ? this.name.length <= 20 ? cleanSpecialChars(this.name) : cleanSpecialChars(this.name).slice(0, 17) + "..." : "", url: this.url ? this.url.length <= 50 ? cleanSpecialChars(this.url) : cleanSpecialChars(this.url).slice(0, 47) + "..." : "", }; };