Skip to main content

Property Value Data Types

API

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

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

Methods

  • The instance objects have the following methods:

    1. repr

    This method returns a string which is the representation of how the value type will finally appear in the vCard.

    note

    '>' in the examples below is just the terminal prompt.

    > const textValue = new TextType('Hello, world');

    > textValue.repr();
    'Hello\\, world'
    1. reprXML

    This method returns a string which is the representation of how the value type will finally appear in the XML vCard.

    > const textValue = new TextType('Hello, world');

    > textValue.reprXML();
    '<text>Hello, world</text>'
    1. reprJSON

    This method returns an array showing how the value type will finally appear in the jCard.

    > const textValue = new TextType('Hello, world');

    > textValue.reprJSON();
    [ 'text', 'Hello, world' ]