From f078dae80a30997a57460c41cfa776d015ee8254 Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Mon, 6 Jul 2015 09:50:02 +0200 Subject: [PATCH] Make sure double imports work in node --- build/ical.js | 39 +++++++++------------------------------ lib/ical/design.js | 3 --- lib/ical/duration.js | 3 --- lib/ical/helpers.js | 18 +++++++++--------- lib/ical/period.js | 3 --- lib/ical/recur.js | 3 --- lib/ical/time.js | 3 --- lib/ical/timezone.js | 3 --- lib/ical/vcard_time.js | 3 --- 9 files changed, 18 insertions(+), 60 deletions(-) diff --git a/build/ical.js b/build/ical.js index cd2721ef..089d2e3a 100644 --- a/build/ical.js +++ b/build/ical.js @@ -3,20 +3,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * Portions Copyright (C) Philipp Kewisch, 2011-2015 */ + /* istanbul ignore next */ /* jshint ignore:start */ -if (typeof ICAL === 'undefined') { - if (typeof exports === 'object') { - // CommonJS - ICAL = exports; - } else if (typeof window !== 'undefined') { - // Browser globals +if (typeof module === 'object') { + // CommonJS, where exports may be different each time. + ICAL = module.exports; +} else /* istanbul ignore next */ if (typeof window !== 'undefined') { + if (typeof ICAL !== 'object') { /** @ignore */ this.ICAL = {}; - } else { - // ...? - ICAL = {}; } +} else /* istanbul ignore next */ { + // ...? + ICAL = {}; } /* jshint ignore:end */ @@ -329,9 +329,6 @@ ICAL.helpers = { /** @namespace ICAL */ -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - /** * This symbol is further described later on @@ -3284,9 +3281,6 @@ ICAL.Binary = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /** * @classdesc @@ -3511,9 +3505,6 @@ ICAL.Binary = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var DURATION_LETTERS = /([PDWHMTS]{1,1})/; @@ -3872,9 +3863,6 @@ ICAL.Binary = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var OPTIONS = ["tzid", "location", "tznames", "latitude", "longitude"]; @@ -4496,9 +4484,6 @@ ICAL.TimezoneService = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /** @@ -5794,9 +5779,6 @@ ICAL.TimezoneService = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /** @@ -5993,9 +5975,6 @@ ICAL.TimezoneService = (function() { -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var DOW_MAP = { SU: ICAL.Time.SUNDAY, diff --git a/lib/ical/design.js b/lib/ical/design.js index 7ca8f03e..fe1f300e 100644 --- a/lib/ical/design.js +++ b/lib/ical/design.js @@ -5,9 +5,6 @@ /** @namespace ICAL */ -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - /** * This symbol is further described later on diff --git a/lib/ical/duration.js b/lib/ical/duration.js index b3011a93..477b42bf 100644 --- a/lib/ical/duration.js +++ b/lib/ical/duration.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var DURATION_LETTERS = /([PDWHMTS]{1,1})/; diff --git a/lib/ical/helpers.js b/lib/ical/helpers.js index 18f50646..a284e638 100644 --- a/lib/ical/helpers.js +++ b/lib/ical/helpers.js @@ -3,20 +3,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * Portions Copyright (C) Philipp Kewisch, 2011-2015 */ + /* istanbul ignore next */ /* jshint ignore:start */ -if (typeof ICAL === 'undefined') { - if (typeof exports === 'object') { - // CommonJS - ICAL = exports; - } else if (typeof window !== 'undefined') { - // Browser globals +if (typeof module === 'object') { + // CommonJS, where exports may be different each time. + ICAL = module.exports; +} else /* istanbul ignore next */ if (typeof window !== 'undefined') { + if (typeof ICAL !== 'object') { /** @ignore */ this.ICAL = {}; - } else { - // ...? - ICAL = {}; } +} else /* istanbul ignore next */ { + // ...? + ICAL = {}; } /* jshint ignore:end */ diff --git a/lib/ical/period.js b/lib/ical/period.js index 073de0b2..e7bde140 100644 --- a/lib/ical/period.js +++ b/lib/ical/period.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /** * @classdesc diff --git a/lib/ical/recur.js b/lib/ical/recur.js index 95b76744..9a587ec2 100644 --- a/lib/ical/recur.js +++ b/lib/ical/recur.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var DOW_MAP = { SU: ICAL.Time.SUNDAY, diff --git a/lib/ical/time.js b/lib/ical/time.js index 9b6ca1c3..5f6f2c1c 100644 --- a/lib/ical/time.js +++ b/lib/ical/time.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /** diff --git a/lib/ical/timezone.js b/lib/ical/timezone.js index 1483187f..b5ff9a41 100644 --- a/lib/ical/timezone.js +++ b/lib/ical/timezone.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { var OPTIONS = ["tzid", "location", "tznames", "latitude", "longitude"]; diff --git a/lib/ical/vcard_time.js b/lib/ical/vcard_time.js index 1e06e8f0..5e8f8b56 100644 --- a/lib/ical/vcard_time.js +++ b/lib/ical/vcard_time.js @@ -5,9 +5,6 @@ "use strict"; -/* istanbul ignore next */ -(typeof(ICAL) === 'undefined') ? ICAL = {} : ''; // jshint ignore:line - (function() { /**