mirror of
https://github.com/clarencechaan/ufc-cal.git
synced 2026-10-19 08:38:30 -07:00
Add node_modules
This commit is contained in:
1 parent
1df571f777
commit
c01615d999
530 files changed
+38186
No files matched your search
+94
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = formatEvent;
|
||||
var _utils = require("../utils");
|
||||
function formatEvent() {
|
||||
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var title = attributes.title,
|
||||
productId = attributes.productId,
|
||||
method = attributes.method,
|
||||
uid = attributes.uid,
|
||||
sequence = attributes.sequence,
|
||||
timestamp = attributes.timestamp,
|
||||
start = attributes.start,
|
||||
startType = attributes.startType,
|
||||
startInputType = attributes.startInputType,
|
||||
startOutputType = attributes.startOutputType,
|
||||
duration = attributes.duration,
|
||||
end = attributes.end,
|
||||
endInputType = attributes.endInputType,
|
||||
endOutputType = attributes.endOutputType,
|
||||
description = attributes.description,
|
||||
url = attributes.url,
|
||||
geo = attributes.geo,
|
||||
location = attributes.location,
|
||||
status = attributes.status,
|
||||
categories = attributes.categories,
|
||||
organizer = attributes.organizer,
|
||||
attendees = attributes.attendees,
|
||||
alarms = attributes.alarms,
|
||||
recurrenceRule = attributes.recurrenceRule,
|
||||
busyStatus = attributes.busyStatus,
|
||||
transp = attributes.transp,
|
||||
classification = attributes.classification,
|
||||
created = attributes.created,
|
||||
lastModified = attributes.lastModified,
|
||||
calName = attributes.calName,
|
||||
htmlContent = attributes.htmlContent;
|
||||
var icsFormat = '';
|
||||
icsFormat += 'BEGIN:VCALENDAR\r\n';
|
||||
icsFormat += 'VERSION:2.0\r\n';
|
||||
icsFormat += 'CALSCALE:GREGORIAN\r\n';
|
||||
icsFormat += (0, _utils.foldLine)("PRODID:".concat(productId)) + '\r\n';
|
||||
icsFormat += (0, _utils.foldLine)("METHOD:".concat(method)) + '\r\n';
|
||||
icsFormat += calName ? (0, _utils.foldLine)("X-WR-CALNAME:".concat(calName)) + '\r\n' : '';
|
||||
icsFormat += "X-PUBLISHED-TTL:PT1H\r\n";
|
||||
icsFormat += 'BEGIN:VEVENT\r\n';
|
||||
icsFormat += "UID:".concat(uid, "\r\n");
|
||||
icsFormat += (0, _utils.foldLine)("SUMMARY:".concat(title ? (0, _utils.setSummary)(title) : title)) + '\r\n';
|
||||
icsFormat += "DTSTAMP:".concat(timestamp, "\r\n");
|
||||
|
||||
// All day events like anniversaries must be specified as VALUE type DATE
|
||||
icsFormat += "DTSTART".concat(start && start.length == 3 ? ";VALUE=DATE" : "", ":").concat((0, _utils.formatDate)(start, startOutputType || startType, startInputType), "\r\n");
|
||||
|
||||
// End is not required for all day events on single days (like anniversaries)
|
||||
if (!end || end.length !== 3 || start.length !== end.length || start.some(function (val, i) {
|
||||
return val !== end[i];
|
||||
})) {
|
||||
if (end) {
|
||||
icsFormat += "DTEND".concat(end.length === 3 ? ";VALUE=DATE" : "", ":").concat((0, _utils.formatDate)(end, endOutputType || startOutputType || startType, endInputType || startInputType), "\r\n");
|
||||
}
|
||||
}
|
||||
icsFormat += typeof sequence !== 'undefined' ? "SEQUENCE:".concat(sequence, "\r\n") : '';
|
||||
icsFormat += description ? (0, _utils.foldLine)("DESCRIPTION:".concat((0, _utils.setDescription)(description))) + '\r\n' : '';
|
||||
icsFormat += url ? (0, _utils.foldLine)("URL:".concat(url)) + '\r\n' : '';
|
||||
icsFormat += geo ? (0, _utils.foldLine)("GEO:".concat((0, _utils.setGeolocation)(geo))) + '\r\n' : '';
|
||||
icsFormat += location ? (0, _utils.foldLine)("LOCATION:".concat((0, _utils.setLocation)(location))) + '\r\n' : '';
|
||||
icsFormat += status ? (0, _utils.foldLine)("STATUS:".concat(status)) + '\r\n' : '';
|
||||
icsFormat += categories ? (0, _utils.foldLine)("CATEGORIES:".concat(categories)) + '\r\n' : '';
|
||||
icsFormat += organizer ? (0, _utils.foldLine)("ORGANIZER;".concat((0, _utils.setOrganizer)(organizer))) + '\r\n' : '';
|
||||
icsFormat += busyStatus ? (0, _utils.foldLine)("X-MICROSOFT-CDO-BUSYSTATUS:".concat(busyStatus)) + '\r\n' : '';
|
||||
icsFormat += transp ? (0, _utils.foldLine)("TRANSP:".concat(transp)) + '\r\n' : '';
|
||||
icsFormat += classification ? (0, _utils.foldLine)("CLASS:".concat(classification)) + '\r\n' : '';
|
||||
icsFormat += created ? 'CREATED:' + (0, _utils.formatDate)(created) + '\r\n' : '';
|
||||
icsFormat += lastModified ? 'LAST-MODIFIED:' + (0, _utils.formatDate)(lastModified) + '\r\n' : '';
|
||||
icsFormat += htmlContent ? (0, _utils.foldLine)("X-ALT-DESC;FMTTYPE=text/html:".concat(htmlContent)) + '\r\n' : '';
|
||||
if (attendees) {
|
||||
attendees.map(function (attendee) {
|
||||
icsFormat += (0, _utils.foldLine)("ATTENDEE;".concat((0, _utils.setContact)(attendee))) + '\r\n';
|
||||
});
|
||||
}
|
||||
icsFormat += recurrenceRule ? "RRULE:".concat(recurrenceRule, "\r\n") : '';
|
||||
icsFormat += duration ? "DURATION:".concat((0, _utils.formatDuration)(duration), "\r\n") : '';
|
||||
if (alarms) {
|
||||
alarms.map(function (alarm) {
|
||||
icsFormat += (0, _utils.setAlarm)(alarm);
|
||||
});
|
||||
}
|
||||
icsFormat += "END:VEVENT\r\n";
|
||||
icsFormat += "END:VCALENDAR\r\n";
|
||||
return icsFormat;
|
||||
}
|
||||
Reference in new issue
Block a user