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.
43 lines (32 loc) • 1.02 kB
JavaScript
import { BaseParameter } from "./BaseParameter.js";
import { MissingArgument } from "../errors/index.js";
export class LabelParameter extends BaseParameter {
static param = "LABEL";
static identifier = "LabelParameter";
#labelValue;
get value() {
return this.#labelValue.repr();
}
get valueXML() {
return this.#labelValue.reprXML();
}
get valueJSON() {
return this.#labelValue.reprJSON();
}
#validate(labelValue) {
if (typeof labelValue === "undefined")
throw new MissingArgument("Value for LabelParameter must be supplied");
else if (labelValue.constructor.identifier !== "ParameterValueType")
throw new TypeError(
"Value for LabelParameter should be of type ParameterValueType"
);
}
constructor(labelValue) {
super();
this.#validate(labelValue);
this.#labelValue = labelValue;
this.checkAbstractPropertiesAndMethods();
Object.freeze(this);
}
}
Object.freeze(LabelParameter);