Skip to content

Commit

Permalink
feat(vcard): phone-number escape comma and semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Oct 17, 2022
1 parent 1014490 commit 660b743
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/ical/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,18 @@ const vcardValues = extend(commonValues, {
timestamp: icalValues['date-time'],
"language-tag": {
matches: /^[a-zA-Z0-9-]+$/ // Could go with a more strict regex here
},
"phone-number": {
fromICAL: function(aValue) {
return Array.from(aValue).filter(function(c) {
return c === '\\' ? undefined : c;
}).join('');
},
toICAL: function(aValue) {
return Array.from(aValue).map(function(c) {
return c === ',' || c === ";" ? '\\' + c : c;
}).join('');
}
}
});

Expand Down Expand Up @@ -798,10 +810,7 @@ let vcard3Values = extend(commonValues, {
binary: icalValues.binary,
date: vcardValues.date,
"date-time": vcardValues["date-time"],
"phone-number": {
// TODO
/* ... */
},
"phone-number": vcardValues["phone-number"],
uri: icalValues.uri,
text: icalValues.text,
time: icalValues.time,
Expand Down

0 comments on commit 660b743

Please sign in to comment.