Giter Club home page Giter Club logo

vcard's Introduction

vCard

vCard (vcf) parser in javascript

Introduction

vCard Parser parses the vCard (or .vcf file contents) to a JSON object. Supports multiple vCard entries.

Usage

Include parser.js file in your project.

var result = vCardParser.parse(data);

You may check the test.html for more detail and samples.

Sample Input

BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;;
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
PHOTO;MEDIATYPE=image/gif:http://www.example.com/dir_photos/my_photo.gif
TEL;TYPE=work,voice;VALUE=uri:tel:+11115551212
TEL;TYPE=home,voice;VALUE=uri:tel:+14045551212
ADR;TYPE=work;LABEL="100 Waters Edge\nBaytown, LA 30314\nUnited States of A
 merica":;;100 Waters Edge;Baytown;LA;30314;United States of America
ADR;TYPE=home;LABEL="42 Plantation St.\nBaytown, LA 30314\nUnited States of
 America":;;42 Plantation St.;Baytown;LA;30314;United States of America
EMAIL:[email protected]
REV:20080424T195243Z
END:VCARD

Sample Result

[
     {
         "name": {
             "surname": "Gump",
             "name": "Forrest",
             "additionalName": "",
             "prefix": "",
             "suffix": ""
         },
         "displayName": "Forrest Gump",
         "organization": "Bubba Gump Shrimp Co.",
         "title": "Shrimp Man",
         "photo": "http://www.example.com/dir_photos/my_photo.gif",
         "telephone": [
             {
                 "isDefault": false,
                 "valueInfo": {
                     "TYPE": "work,voice",
                     "VALUE": "uri"
                 },
                 "value": "tel:+11115551212"
             },
             {
                 "isDefault": false,
                 "valueInfo": {
                     "TYPE": "home,voice",
                     "VALUE": "uri"
                 },
                 "value": "tel:+14045551212"
             }
         ],
         "address": [
             {
                 "isDefault": false,
                 "valueInfo": {
                     "TYPE": "work",
                     "LABEL": "100 Waters Edge\nBaytown, LA 30314\nUnited States of America"
                 },
                 "value": {
                     "postOfficeBox": "",
                     "number": "",
                     "street": "100 Waters Edge",
                     "city": "Baytown",
                     "region": "LA",
                     "postalCode": "30314",
                     "country": "United States of America"
                 }
             },
             {
                 "isDefault": false,
                 "valueInfo": {
                     "TYPE": "home",
                     "LABEL": "42 Plantation St.\nBaytown, LA 30314\nUnited States ofAmerica"
                 },
                 "value": {
                     "postOfficeBox": "",
                     "number": "",
                     "street": "42 Plantation St.",
                     "city": "Baytown",
                     "region": "LA",
                     "postalCode": "30314",
                     "country": "United States of America"
                 }
             }
         ],
         "email": [
             {
                 "isDefault": false,
                 "valueInfo": {
                     "TYPE": "home",
                     "LABEL": "42 Plantation St.\nBaytown, LA 30314\nUnited States ofAmerica"
                 },
                 "value": "[email protected]"
             }
         ]
     }
 ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.