Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cozy-ical

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cozy-ical - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

39

lib/event.js
// Generated by CoffeeScript 1.6.3
(function() {
var moment, time;
var icalDateToUTC, moment, time;

@@ -9,2 +9,15 @@ time = require('time');

icalDateToUTC = function(date, tzid) {
var isUTC, mdate, tdate;
isUTC = date[date.length - 1] === 'Z';
mdate = moment(date, "YYYYMMDDTHHmm00");
if (isUTC) {
tdate = new time.Date(mdate, 'UTC');
} else {
tdate = new time.Date(mdate, tzid);
tdate.setTimezone('UTC');
}
return tdate;
};
module.exports = function(Event) {

@@ -14,3 +27,3 @@ var VCalendar, VEvent, _ref;

Event.prototype.toIcal = function(timezone) {
var endDate, startDate;
var endDate, event, startDate;
if (timezone == null) {

@@ -23,3 +36,7 @@ timezone = "UTC";

endDate.setTimezone(timezone, false);
return new VEvent(startDate, endDate, this.description, this.place, this.id, this.details);
event = new VEvent(startDate, endDate, this.description, this.place, this.id, this.details);
if (this.rrule) {
event.fields['RRULE'] = this.rrule;
}
return event;
};

@@ -34,13 +51,6 @@ Event.fromIcal = function(vevent, timezone) {

event.details = vevent.fields["DESCRIPTION"] || vevent.fields["SUMMARY"];
if (event.description == null) {
event.description = event.details;
}
event.place = vevent.fields["LOCATION"];
startDate = vevent.fields["DTSTART"];
startDate = moment(startDate, "YYYYMMDDTHHmm00");
startDate = new time.Date(new Date(startDate), timezone);
endDate = vevent.fields["DTEND"];
endDate = moment(endDate, "YYYYMMDDTHHmm00");
endDate = new time.Date(new Date(endDate), timezone);
event.timezone = timezone;
event.rrule = vevent.fields["RRULE"];
startDate = icalDateToUTC(vevent.fields["DTSTART"], vevent.fields["DTSTART-TZID"] || timezone);
endDate = icalDateToUTC(vevent.fields["DTEND"], vevent.fields["DTEND-TZID"] || timezone);
event.start = startDate.toString().slice(0, 24);

@@ -54,5 +64,2 @@ event.end = endDate.toString().slice(0, 24);

component.walk(function(component) {
if (component.name === 'VTIMEZONE') {
timezone = component.fields["TZID"];
}
if (component.name === 'VEVENT') {

@@ -59,0 +66,0 @@ return events.push(Event.fromIcal(component, timezone));

@@ -6,3 +6,4 @@ // Generated by CoffeeScript 1.6.3

__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice;

@@ -407,3 +408,3 @@ fs = require('fs');

lineParser = function(line) {
var key, tuple, value;
var detail, details, key, pname, pvalue, tuple, value, _i, _len, _ref2, _ref3, _results;
lineNumber++;

@@ -424,4 +425,11 @@ tuple = line.trim().split(':');

} else if ((key != null) && key !== '' && (component != null)) {
key = key.split(';')[0];
return component.fields[key] = value;
_ref2 = key.split(';'), key = _ref2[0], details = 2 <= _ref2.length ? __slice.call(_ref2, 1) : [];
component.fields[key] = value;
_results = [];
for (_i = 0, _len = details.length; _i < _len; _i++) {
detail = details[_i];
_ref3 = detail.split('='), pname = _ref3[0], pvalue = _ref3[1];
_results.push(component.fields["" + key + "-" + pname] = pvalue);
}
return _results;
} else {

@@ -428,0 +436,0 @@ return sendError("Malformed ical file");

{
"name": "cozy-ical",
"version": "0.0.8",
"version": "0.0.9",
"description": "Cozy-Ical provides ICal Parser and Objects",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc