Comparing version 1.1.1 to 1.1.2
@@ -12,1 +12,21 @@ // Generated by CoffeeScript 1.8.0 | ||
}; | ||
module.exports.escapeText = function(s) { | ||
var t; | ||
if (s == null) { | ||
return s; | ||
} | ||
t = s.replace(/([,;\\])/ig, "\\$1"); | ||
t = t.replace(/\n/g, '\\n'); | ||
return t; | ||
}; | ||
module.exports.unescapeText = function(t) { | ||
var s; | ||
if (t == null) { | ||
return t; | ||
} | ||
s = t.replace(/\\n/g, '\n'); | ||
s = s.replace(/\\([,;\\])/ig, "$1"); | ||
return s; | ||
}; |
@@ -162,2 +162,9 @@ // Generated by CoffeeScript 1.8.0 | ||
VComponent.prototype.addTextField = function(key, value, details) { | ||
if (details == null) { | ||
details = {}; | ||
} | ||
return this.addRawField(key, helpers.escapeText(value), details); | ||
}; | ||
VComponent.prototype.getRawField = function(key, findMany) { | ||
@@ -185,2 +192,9 @@ var defaultResult, field, _i, _len, _ref1; | ||
VComponent.prototype.getTextFieldValue = function(key, defaults) { | ||
var field, value; | ||
field = this.getRawField(key, false); | ||
value = helpers.unescapeText(field != null ? field.value : void 0); | ||
return value || defaults; | ||
}; | ||
return VComponent; | ||
@@ -326,27 +340,27 @@ | ||
} | ||
this.addRawField('DESCRIPTION', this.model.description); | ||
this.addTextField('DESCRIPTION', this.model.description); | ||
this.addRawField('DURATION', this.model.duration || null); | ||
this.addRawField('REPEAT', this.model.repeat || null); | ||
return this.addRawField('SUMMARY', this.model.summary); | ||
return this.addTextField('SUMMARY', this.model.summary); | ||
}; | ||
VAlarm.prototype.extract = function() { | ||
var action, attendees, description, expected, summary, trigger, _ref1, _ref10, _ref11, _ref12, _ref13, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; | ||
var action, attendees, description, expected, summary, trigger, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; | ||
VAlarm.__super__.extract.call(this); | ||
trigger = ((_ref1 = this.getRawField('TRIGGER')) != null ? _ref1.value : void 0) || null; | ||
description = (_ref2 = this.getRawField('DESCRIPTION')) != null ? _ref2.value : void 0; | ||
description = this.getTextFieldValue('DESCRIPTION'); | ||
attendees = this.getRawField('ATTENDEE', true); | ||
attendees = attendees != null ? attendees.map(function(attendee) { | ||
var detail, details, email, key, name, status, _i, _len, _ref3, _ref4, _ref5, _ref6; | ||
var detail, details, email, key, name, status, _i, _len, _ref2, _ref3, _ref4, _ref5; | ||
email = attendee.value.replace('mailto:', ''); | ||
if (((_ref3 = attendee.details) != null ? _ref3.length : void 0) > 0) { | ||
if (((_ref2 = attendee.details) != null ? _ref2.length : void 0) > 0) { | ||
details = {}; | ||
_ref4 = attendee.details; | ||
for (_i = 0, _len = _ref4.length; _i < _len; _i++) { | ||
detail = _ref4[_i]; | ||
_ref3 = attendee.details; | ||
for (_i = 0, _len = _ref3.length; _i < _len; _i++) { | ||
detail = _ref3[_i]; | ||
if (detail.indexOf('PARTSTAT') !== -1) { | ||
_ref5 = detail.split('='), key = _ref5[0], status = _ref5[1]; | ||
_ref4 = detail.split('='), key = _ref4[0], status = _ref4[1]; | ||
details.status = status; | ||
} else if (detail.indexOf('CN') !== -1) { | ||
_ref6 = detail.split('='), key = _ref6[0], name = _ref6[1]; | ||
_ref5 = detail.split('='), key = _ref5[0], name = _ref5[1]; | ||
details.name = name; | ||
@@ -366,20 +380,20 @@ } | ||
}) : void 0; | ||
summary = (_ref3 = this.getRawField('SUMMARY')) != null ? _ref3.value : void 0; | ||
summary = this.getTextFieldValue('SUMMARY'); | ||
expected = [VAlarm.DISPLAY_ACTION, VAlarm.EMAIL_ACTION, VAlarm.AUDIO_ACTION]; | ||
action = (_ref4 = this.getRawField('ACTION')) != null ? _ref4.value : void 0; | ||
action = (_ref2 = this.getRawField('ACTION')) != null ? _ref2.value : void 0; | ||
if (__indexOf.call(expected, action) < 0) { | ||
action = VAlarm.DISPLAY_ACTION; | ||
if (description == null) { | ||
description = ((_ref5 = this.parent) != null ? (_ref6 = _ref5.getRawField('SUMMARY')) != null ? _ref6.value : void 0 : void 0) || ''; | ||
description = (_ref3 = this.parent) != null ? _ref3.getTextFieldValue('SUMMARY', '') : void 0; | ||
} | ||
} else if (action === VAlarm.DISPLAY_ACTION) { | ||
if (description == null) { | ||
description = ((_ref7 = this.parent) != null ? (_ref8 = _ref7.getRawField('SUMMARY')) != null ? _ref8.value : void 0 : void 0) || ''; | ||
description = (_ref4 = this.parent) != null ? _ref4.getTextFieldValue('SUMMARY', '') : void 0; | ||
} | ||
} else if (action === VAlarm.EMAIL_ACTION) { | ||
if (description == null) { | ||
description = ((_ref9 = this.parent) != null ? (_ref10 = _ref9.getRawField('DESCRIPTION')) != null ? _ref10.value : void 0 : void 0) || ''; | ||
description = (_ref5 = this.parent) != null ? _ref5.getTextFieldValue('DESCRIPTION', '') : void 0; | ||
} | ||
if (summary == null) { | ||
summary = ((_ref11 = this.parent) != null ? (_ref12 = _ref11.getRawField('SUMMARY')) != null ? _ref12.value : void 0 : void 0) || ''; | ||
summary = (_ref6 = this.parent) != null ? _ref6.getTextFieldValue('SUMMARY', '') : void 0; | ||
} | ||
@@ -395,3 +409,3 @@ if (attendees == null) { | ||
description: description, | ||
repeat: ((_ref13 = this.getRawField('REPEAT')) != null ? _ref13.value : void 0) || null, | ||
repeat: ((_ref7 = this.getRawField('REPEAT')) != null ? _ref7.value : void 0) || null, | ||
summary: summary | ||
@@ -439,11 +453,11 @@ }; | ||
} | ||
this.addRawField('DESCRIPTION', this.model.description || null); | ||
this.addTextField('DESCRIPTION', this.model.description || null); | ||
this.addRawField('DTSTART', formattedStartDate || null); | ||
this.addRawField('DUE', this.model.due || null); | ||
this.addRawField('DURATION', this.model.duration || null); | ||
return this.addRawField('SUMMARY', this.model.summary || null); | ||
return this.addTextField('SUMMARY', this.model.summary || null); | ||
}; | ||
VTodo.prototype.extract = function() { | ||
var details, due, duration, stampDate, startDate, timezone, _, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; | ||
var details, due, duration, stampDate, startDate, timezone, _, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6; | ||
VTodo.__super__.extract.call(this); | ||
@@ -474,7 +488,7 @@ stampDate = ((_ref1 = this.getRawField('DTSTAMP')) != null ? _ref1.value : void 0) || moment().tz('UTC'); | ||
stampDate: moment.tz(stampDate, VTodo.icalDTUTCFormat, 'UTC').toDate(), | ||
description: ((_ref7 = this.getRawField('DESCRIPTION')) != null ? _ref7.value : void 0) || '', | ||
description: this.getTextFieldValue('DESCRIPTION', ''), | ||
startDate: startDate.toDate(), | ||
due: due, | ||
duration: duration, | ||
summary: ((_ref8 = this.getRawField('SUMMARY')) != null ? _ref8.value : void 0) || '', | ||
summary: this.getTextFieldValue('SUMMARY', ''), | ||
timezone: timezone | ||
@@ -590,13 +604,13 @@ }; | ||
this.addRawField('CREATED', created || null); | ||
this.addRawField('DESCRIPTION', this.model.description || null); | ||
this.addTextField('DESCRIPTION', this.model.description || null); | ||
this.addRawField('DURATION', this.model.duration || null); | ||
this.addRawField('LAST-MOD', lastModification || null); | ||
this.addRawField('LOCATION', this.model.location || null); | ||
this.addTextField('LOCATION', this.model.location || null); | ||
this.addRawField('ORGANIZER', this.model.organizer || null); | ||
this.addRawField('RRULE', rrule || null); | ||
return this.addRawField('SUMMARY', this.model.summary || null); | ||
return this.addTextField('SUMMARY', this.model.summary || null); | ||
}; | ||
VEvent.prototype.extract = function() { | ||
var allDay, attendees, created, daysNum, dtend, dtstart, duration, endDate, hoursNum, iCalFormat, lastModification, minutesNum, rrule, rruleOptions, secondsNum, stampDate, startDate, timezone, timezoneEnd, timezoneStart, uid, weeksNum, _, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; | ||
var allDay, attendees, created, daysNum, dtend, dtstart, duration, endDate, hoursNum, iCalFormat, lastModification, minutesNum, rrule, rruleOptions, secondsNum, stampDate, startDate, timezone, timezoneEnd, timezoneStart, uid, weeksNum, _, _ref1, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; | ||
iCalFormat = 'YYYYMMDDTHHmmss'; | ||
@@ -703,7 +717,7 @@ uid = this.getRawField('UID'); | ||
categories: ((_ref10 = this.getRawField('CATEGORIES')) != null ? _ref10.value : void 0) || null, | ||
description: ((_ref11 = this.getRawField('DESCRIPTION')) != null ? _ref11.value : void 0) || null, | ||
location: ((_ref12 = this.getRawField('LOCATION')) != null ? _ref12.value : void 0) || null, | ||
organizer: ((_ref13 = this.getRawField('ORGANIZER')) != null ? _ref13.value : void 0) || null, | ||
description: this.getTextFieldValue('DESCRIPTION', null), | ||
location: this.getTextFieldValue('LOCATION', null), | ||
organizer: ((_ref11 = this.getRawField('ORGANIZER')) != null ? _ref11.value : void 0) || null, | ||
rrule: rruleOptions || null, | ||
summary: ((_ref14 = this.getRawField('SUMMARY')) != null ? _ref14.value : void 0) || null, | ||
summary: this.getTextFieldValue('SUMMARY', null), | ||
allDay: allDay || null, | ||
@@ -710,0 +724,0 @@ timezone: timezone || null, |
{ | ||
"name": "cozy-ical", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Cozy-Ical provides ICal Parser, generators and helpers", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80910
1824