Property Parameters
These "property parameters" contain meta-information about the property or the property value
According to the RFC, the property parameters include:
- LANGUAGE
- VALUE
- PREF
- ALTID
- PID
- TYPE
- MEDIATYPE
- CALSCALE
- SORT-AS
- GEO
- TZ
- LABEL
- CC
- INDEX
- LEVEL
In the library, these are represented by:
The instance object is frozen and therefore its properties and methods cannot be modified after construction, neither can new ones be added
noteThe actual parameter used depends on property. Each property accepts only certain parameters.
API
All the classes listed above are provided as named exports from the main vcard4 module. For example, to import the
LanguageParameter
class:ESMimport { LanguageParameter } from "vcard4";
commonjsconst { LanguageParameter } = require("vcard4");
Methods
The instance objects have the following methods:
repr
This method returns a string which is the representation of how the parameter will finally appear in the vCard.
note'>' in the examples below is just the terminal prompt.
> const preference = new PrefParameter(new IntegerType(1));
> preference.repr()
'PREF=1'reprXML
This method returns a string which is the representation of how the parameter will finally appear in the XML vCard.
> const preference = new PrefParameter(new IntegerType(1));
> preference.reprXML()
'<pref><integer>1</integer></pref>'reprJSON
This method returns an Object showing how the parameter will finally appear in the jCard.
> const preference = new PrefParameter(new IntegerType(1));
> preference.reprJSON()
{ pref: '1' }