npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vcard/vcard4-generator

v0.1.0-beta.1

Published

A vCard 4 generator library.

Downloads

26

Readme

@vcard/vcard4-generator

CI Status

A library for generating v4 vCards

Heads Up!

This is still very much a WIP project and is not feature complete.

Install

npm install @vcard/vcard4-generator

Usage

import Vcard4Generator, { Vcard4GeneratorConfig } from '@vcard/vcard4-generator';

const config: Vcard4GeneratorConfig = {
    fn: 'Captain Awesome',
    email: '[email protected]',
    url: 'http://www.example.com/'
};
const vcard = new Vcard4Generator(config);

vcard.toString();
// >> BEGIN:VCARD
// >> VERSION:4.0
// >> EMAIL:[email protected]
// >> FN:Captain Awesome
// >> URL:http://www.example.com/
// >> END:VCARD

Building

From the monorepo root:

npx lerna --scope @vcard/vcard4-generator run build

Testing

From the monorepo root:

npm test

To-Do

  • [ ] Properties
    • [x] ADR
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LABEL Parameter
      • [x] LANGUAGE Parameter
      • [x] GEO Parameter
      • [x] TZ Parameter
      • [x] ALTID Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
    • [x] ANNIVERSARY
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] ALTID Parameter
      • [x] CALSCALE Parameter (for date-and-or-time type only)
    • [x] BDAY
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] ALTID Parameter
      • [x] CALSCALE Parameter (for date-and-or-time type only)
      • [x] LANGUAGE Parameter (for text type only)
    • [x] BEGIN
      • [x] No Parameters
    • [x] BIRTHPLACE (RFC6474)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
    • [x] CALADRURI
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] CALURI
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] CATEGORIES
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] ALTID Parameter
      • [ ] Implement Constructor Array Argument Support
    • [x] CLIENTPIDMAP
      • [x] Line Folding
      • [x] Value Escaping
      • [x] No Parameters
      • [x] No VALUE Parameter
      • [ ] Implement Constructor Array Argument Support
    • [x] CONTACT-URI (RFC8605)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PREF Parameter
    • [x] DEATHDATE (RFC6474)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] CALSCALE Parameter (for date-and-or-time type only)
      • [x] LANGUAGE Parameter (for text type only)
      • [x] ALTID Parameter
    • [x] DEATHPLACE (RFC6474)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] ALTID Parameter
    • [x] EMAIL
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] ALTID Parameter
    • [x] END
      • [x] No Parameters
    • [x] EXPERTISE (RFC6715)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] LEVEL Parameter
      • [x] INDEX Parameter
      • [x] LANGUAGE Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] FBURL
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] ALTID Parameter
    • [x] FN
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] TYPE Parameter
      • [x] LANGUAGE Parameter
      • [x] ALTID Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
    • [x] GENDER
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [ ] Implement Constructor Array Argument Support
    • [x] GEO
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] HOBBY (RFC6715)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] LEVEL Parameter
      • [x] INDEX Parameter
      • [x] LANGUAGE Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] IMPP
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] INTEREST (RFC6715)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] LEVEL Parameter
      • [x] INDEX Parameter
      • [x] LANGUAGE Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] KEY
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] MEDIATYPE Parameter (for URI type only)
      • [x] ALTID Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
    • [x] KIND
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
    • [x] LANG
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] LOGO
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] MEMBER
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] MEDIATYPE Parameter
    • [x] N
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] SORT-AS Parameter
      • [x] LANGUAGE Parameter
      • [x] ALTID Parameter
    • [x] NICKNAME
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] TYPE Parameter
      • [x] LANGUAGE Parameter
      • [x] ALTID Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
    • [x] NOTE
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] ALTID Parameter
    • [x] ORG
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] SORT-AS Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] ORG-DIRECTORY (RFC6715)
      • [x] Line Folding
      • [x] Value Escaping
      • [x] INDEX Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] PHOTO
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] PREF Parameter
      • [x] PID Parameter
    • [x] PRODID
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
    • [x] RELATED
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] MEDIATYPE Parameter (for URI type only)
      • [x] LANGUAGE Parameter (for text type only)
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] REV
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
    • [x] ROLE
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] ALTID Parameter
    • [x] SOUND
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] SOURCE
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] MEDIATYPE Parameter
    • [x] TEL
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] MEDIATYPE Parameter (for URI type only)
      • [x] TYPE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
    • [x] TITLE
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] LANGUAGE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] ALTID Parameter
      • [x] TYPE Parameter
    • [x] TZ
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] ALTID Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
    • [x] UID
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
    • [x] URL
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] PID Parameter
      • [x] PREF Parameter
      • [x] TYPE Parameter
      • [x] MEDIATYPE Parameter
      • [x] ALTID Parameter
    • [x] VERSION
      • [x] No Parameters
    • [x] XML
      • [x] Line Folding
      • [x] Value Escaping
      • [x] VALUE Parameter
      • [x] ALTID Parameter
  • [x] Implement Parameter Value Encoding as Specified in RFC6868

Reference

Property Cardinalities

Property cardinalities are indicated using the following notation, which is based on ABNF (see [RFC5234], Section 3.6):

| Cardinality | Meaning | |:-----------:|--------------------------------------------------| | 1 | Exactly one instance per vCard MUST be present. | | 1 | Exactly one instance per vCard MAY be present. | | 1 | One or more instances per vCard MUST be present. | | * | One or more instances per vCard MAY be present. |

Properties defined in a vCard instance may have multiple values depending on the property cardinality. The general rule for encoding multi-valued properties is to simply create a new content line for each value (including the property name). However, it should be noted that some value types support encoding multiple values in a single content line by separating the values with a comma ",". This approach has been taken for several of the content types defined below (date, time, integer, float).

Property Parameters

A property can have attributes associated with it. These "property parameters" contain meta-information about the property or the property value. In some cases, the property parameter can be multi- valued in which case the property parameter value elements are separated by a COMMA (U+002C).

Property parameter value elements that contain the COLON (U+003A), SEMICOLON (U+003B), or COMMA (U+002C) character separators MUST be specified as quoted-string text values. Property parameter values MUST NOT contain the DQUOTE (U+0022) character. The DQUOTE character is used as a delimiter for parameter values that contain restricted characters or URI text.

Applications MUST ignore x-param and iana-param values they don't recognize.

Property Value Escaping

Some properties may contain one or more values delimited by a COMMA character (U+002C). Therefore, a COMMA character in a value MUST be escaped with a BACKSLASH character (U+005C), even for properties that don't allow multiple instances (for consistency).

Some properties (e.g., N and ADR) comprise multiple fields delimited by a SEMICOLON character (U+003B). Therefore, a SEMICOLON in a field of such a "compound" property MUST be escaped with a BACKSLASH character. SEMICOLON characters in non-compound properties MAY be escaped. On input, an escaped SEMICOLON character is never a field separator. An unescaped SEMICOLON character may be a field separator, depending on the property in which it appears.

Furthermore, some fields of compound properties may contain a list of values delimited by a COMMA character. Therefore, a COMMA character in one of a field's values MUST be escaped with a BACKSLASH character, even for fields that don't allow multiple values (for consistency). Compound properties allowing multiple instances MUST NOT be encoded in a single content line.

Finally, BACKSLASH characters in values MUST be escaped with a BACKSLASH character. NEWLINE (U+000A) characters in values MUST be encoded by two characters: a BACKSLASH followed by either an 'n' (U+006E) or an 'N' (U+004E).

In all other cases, escaping MUST NOT be used.

Links

License

The MIT License (Expat). See the license file for details.