Commit 14439b31 authored by Sebastian Pekarek's avatar Sebastian Pekarek
Browse files

⌥⌘L

parent 85dc1075
......@@ -6,7 +6,7 @@ module.exports.formatDate = function formatDate(d, dateonly, floating) {
var s;
function pad(i) {
return (i < 10 ? '0': '') + i;
return (i < 10 ? '0' : '') + i;
}
s = d.getUTCFullYear();
......
......@@ -158,7 +158,7 @@ var ICalAlarm = function(_data, event) {
return data.attach;
}
var attach= null;
var attach = null;
if(typeof _attach === 'string') {
attach = {
uri: _attach,
......@@ -254,7 +254,7 @@ var ICalAlarm = function(_data, event) {
if(data.type === 'audio' && data.attach && data.attach.mime) {
g += 'ATTACH;FMTTYPE=' + data.attach.mime + ':' + data.attach.uri + '\r\n';
}
else if(data.type === 'audio' && data.attach ) {
else if(data.type === 'audio' && data.attach) {
g += 'ATTACH;VALUE=URI:' + data.attach.uri + '\r\n';
}
else if(data.type === 'audio') {
......
......@@ -42,18 +42,18 @@ var ICalAttendee = function(_data, event) {
return getAllowedStringFor('status', str);
}
function getAllowedType(str){
function getAllowedType(str) {
return getAllowedStringFor('type', str);
}
function getAllowedStringFor(type, str) {
if (!str || typeof(str) !== 'string') {
if(!str || typeof(str) !== 'string') {
throw new Error('Input for `' + type + '` must be a non-empty string. You gave ' + str);
}
str = str.toUpperCase();
if (vars.allowed[type].indexOf(str) === -1) {
if(vars.allowed[type].indexOf(str) === -1) {
throw new Error('`' + type + '` must be one of the following: ' + vars.allowed[type].join(', ') + '!');
}
......@@ -137,7 +137,7 @@ var ICalAttendee = function(_data, event) {
* @returns {ICalAttendee|String}
*/
this.type = function(type) {
if (type === undefined) {
if(type === undefined) {
return data.type;
}
data.type = getAllowedType(type);
......@@ -229,7 +229,7 @@ var ICalAttendee = function(_data, event) {
g += ';ROLE=' + data.role;
// TYPE
if (data.type) {
if(data.type) {
g += ';CUTYPE=' + data.type;
}
......
......@@ -243,7 +243,6 @@ var ICalCalendar = function(_data) {
}
var ICalEvent = require('./event.js'),
e;
......
......@@ -18,7 +18,7 @@ var ICalEvent = function(_data) {
};
data = {
id: ('0000' + (Math.random() * Math.pow(36,4) << 0).toString(36)).substr(-4),
id: ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4),
start: null,
end: null,
stamp: new Date(),
......@@ -501,7 +501,7 @@ var ICalEvent = function(_data) {
if(data.allDay) {
g += 'DTSTART;VALUE=DATE:' + tools.formatDate(data.start, true) + '\r\n';
g += 'DTEND;VALUE=DATE:' + tools.formatDate(data.end, true) + '\r\n';
}else{
} else {
g += 'DTSTART:' + tools.formatDate(data.start, false, data.floating) + '\r\n';
g += 'DTEND:' + tools.formatDate(data.end, false, data.floating) + '\r\n';
}
......@@ -535,7 +535,7 @@ var ICalEvent = function(_data) {
// DESCRIPTION
if(data.description) {
g += 'DESCRIPTION:' + tools.escape(data.description ) + '\r\n';
g += 'DESCRIPTION:' + tools.escape(data.description) + '\r\n';
}
// ORGANIZER
......
......@@ -1215,12 +1215,12 @@ describe('ical-generator 0.2.x / ICalCalendar', function() {
assert.equal(a.status(), 'ACCEPTED');
});
it('should throw error when method empty', function() {
var a = ical().createEvent().createAttendee();
assert.throws(function() {
a.status('');
}, /`status` must be a non-empty string/);
});
it('should throw error when method empty', function() {
var a = ical().createEvent().createAttendee();
assert.throws(function() {
a.status('');
}, /`status` must be a non-empty string/);
});
it('should throw error when method not allowed', function() {
var a = ical().createEvent().createAttendee();
......@@ -1253,12 +1253,12 @@ describe('ical-generator 0.2.x / ICalCalendar', function() {
assert.equal(a.type(), 'ROOM');
});
it('should throw error when method empty', function() {
var a = ical().createEvent().createAttendee();
assert.throws(function() {
a.type('');
}, /`type` must be a non-empty string/);
});
it('should throw error when method empty', function() {
var a = ical().createEvent().createAttendee();
assert.throws(function() {
a.type('');
}, /`type` must be a non-empty string/);
});
it('should throw error when method not allowed', function() {
var a = ical().createEvent().createAttendee();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment