Skip to main content

Property Parameters

API

  • All the classes listed above are provided as named exports from the main vcard4 module. For example, to import the LanguageParameter class:

    ESM
    import { LanguageParameter } from "vcard4";
    commonjs
    const { LanguageParameter } = require("vcard4");

Methods

  • The instance objects have the following methods:

    1. 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'
    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>'
    1. 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' }