Skip to content

tncho/vcard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 bower:

bower install vcard

Using npm:

npm install vcard-parser

Example of usage:

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);

This project was forked from https://github.com/Heymdall/vcard (only one minor change was needed) Kudos to Aleksandr Kitov [email protected] for his library!

About

Simple js vCard parser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%