pgp-utils
Version:
Simple PGP utils
33 lines (30 loc) • 814 B
JavaScript
// Generated by IcedCoffeeScript 1.7.1-e
(function() {
exports.parse = function(input) {
var components, m, x;
components = null;
x = /^([^(<]*?)(?:\s*\((.*?)\))?(?:\s*<(.*?)>)?$/;
if ((m = input.match(x)) != null) {
components = {
username: m[1],
comment: m[2],
email: m[3]
};
}
return components;
};
exports.format = function(d) {
var parts, _ref, _ref1, _ref2;
parts = [];
if ((_ref = d.username) != null ? _ref.length : void 0) {
parts.push(d.username);
}
if ((_ref1 = d.comment) != null ? _ref1.length : void 0) {
parts.push("(" + d.comment + ")");
}
if ((_ref2 = d.email) != null ? _ref2.length : void 0) {
parts.push("<" + d.email + ">");
}
return parts.join(' ');
};
}).call(this);