NeahOpti/node_modules/vcard-parser
2025-04-23 11:11:51 +02:00
..
lib clean without courrier and calendar 2025-04-23 11:11:51 +02:00
.editorconfig clean without courrier and calendar 2025-04-23 11:11:51 +02:00
.travis.yml clean without courrier and calendar 2025-04-23 11:11:51 +02:00
LICENSE clean without courrier and calendar 2025-04-23 11:11:51 +02:00
package.json clean without courrier and calendar 2025-04-23 11:11:51 +02:00
README.md clean without courrier and calendar 2025-04-23 11:11:51 +02:00
yarn.lock clean without courrier and calendar 2025-04-23 11:11:51 +02:00

vcard

Introduction

vcard allow you to parse vCard data into js object and convert js object into vCard data. It can work both in browser and in node.

Installation

Using npm:

npm install vcard-parser

Example of usage:

var vCard = require('vcard-parser');
var raw = 'BEGIN:VCARD\r\n' +
          'FN:Forrest Gump\r\n' +
          'N:Gump;Forrest;;Mr.;\r\n' +
          'TEL;TYPE=HOME:78884545247\r\n' +
          'END:VCARD';
var card = vCard.parse(raw);

expect(card.fn).toEqual([
    {value: 'Forrest Gump'}
]);
expect(card.n).toEqual([{
    value: [
        'Gump', 'Forrest', '', 'Mr.', ''
    ]
}]);
expect(card.tel).toEqual([
    {value: '78884545247', meta: {type: ['HOME']}}
]);

var generated = vCard.generate(card);

expect(generated).toEqual(raw);