UNPKG

vcard-generator

Version:

VCard v4.0 rfc6350 compliant generator from JSON.

43 lines (31 loc) 1.17 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = require('./util'); exports.default = function (_ref) { var pref = _ref.pref, type = _ref.type, label = _ref.label, text = _ref.text, value = _ref.value; return ['EMAIL', (0, _util.formatPref)(pref), (0, _util.formatType)(type || label), ':', (0, _util.encodeText)(text || value)].filter(_util.isSet).join(''); }; /* Cardinality: 0+ (*) EMAIL-param = "VALUE=text" / pid-param / pref-param / type-param / altid-param / any-param EMAIL-value = text EMAIL;TYPE=work:jqpublic@xyz.example.com EMAIL;PREF=1:jane_doe@example.com EMAIL;type=INTERNET;type=HOME;type=pref:a@a.com item1.EMAIL;type=INTERNET:b@b.com item1.X-ABLabel:CustomEmail EMAIL;INTERNET;WORK;CHARSET=utf-8:tester@gmail.com EMAIL;type=INTERNET;type=HOME;type=pref:t@tt.tt item1.EMAIL;type=INTERNET:x@x.xx item1.X-ABLabel:My Email EMAIL;type=INTERNET;type=HOME;type=pref:abc@example.com EMAIL;type=INTERNET;type=WORK:bcd@test.com EMAIL:email@address.com EMAIL;PREF;WORK:a@example.com */