vcard-generator
Version:
VCard v4.0 rfc6350 compliant generator from JSON.
45 lines (33 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = require('./util');
exports.default = function (_ref) {
var pref = _ref.pref,
type = _ref.type,
label = _ref.label,
uri = _ref.uri,
url = _ref.url,
value = _ref.value;
return ['URL', (0, _util.formatPref)(pref), (0, _util.formatType)(type || label), ':', (0, _util.encodeText)(uri || url || value)].filter(_util.isSet).join('');
}; /*
Cardinality: 0+ (*)
URL-param = "VALUE=uri" / pid-param / pref-param / type-param
/ mediatype-param / altid-param / any-param
URL-value = URI
URL:http://example.org/restaurant.french/~chezchic.html
URL:www.google.com
URL:joonhocho.com
URL;WORK;CHARSET=utf-8:https://www.website.com/hellokitty
item4.URL;type=pref:www.example .com
item4.X-ABLabel:_$!<HomePage>!$_
item5.URL:test.com
item5.X-ABLabel:My Web
item1.URL;type=INTERNET,type=HOME:http://homepage.com
item1.X-ABLabel:home page
item2.URL;type=INTERNET:blog.com
item2.X-ABLabel:blog
item3.URL;type=INTERNET;type=WORK:google.com
item3.X-ABLabel:website
*/