UNPKG

vcard4

Version:

An RFC 6350 compliant JavaScript library for generating and parsing version 4.0 vCards. Can also generate RFC 6351 compliant XML vCards and RFC 7095 compliant jCards. TypeScript type declarations are provided.

41 lines (30 loc) 952 B
import { BaseParameter } from "./BaseParameter.js"; import { MissingArgument } from "../errors/index.js"; export class GeoParameter extends BaseParameter { static param = "GEO"; static identifier = "GeoParameter"; #geoValue; get value() { return `"${this.#geoValue.repr()}"`; } get valueXML() { return this.#geoValue.reprXML(); } get valueJSON() { return this.#geoValue.reprJSON(); } #validate(geoValue) { if (typeof geoValue === "undefined") throw new MissingArgument("Value for GeoParameter must be supplied"); else if (geoValue.constructor.identifier !== "URIType") throw new TypeError("Value for GeoParameter must be of type URIType"); } constructor(geoValue) { super(); this.#validate(geoValue); this.#geoValue = geoValue; this.checkAbstractPropertiesAndMethods(); Object.freeze(this); } } Object.freeze(GeoParameter);