possible short-form:

attachmentString = item.attachments.map(function(att) { return [att.title, att.path, att.mimetype].map(function(part) { return part.replace(/([\\{}:;])/g, "\\$1"); }).join(':'); }).join(';');