]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix eslint issues
authorIskren Chernev <iskren.chernev@gmail.com>
Sun, 26 Apr 2020 00:19:45 +0000 (03:19 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 26 Apr 2020 23:14:38 +0000 (02:14 +0300)
86 files changed:
src/lib/create/check-overflow.js
src/lib/create/date-from-array.js
src/lib/create/from-array.js
src/lib/create/from-object.js
src/lib/create/from-string.js
src/lib/create/valid.js
src/lib/duration/as.js
src/lib/duration/bubble.js
src/lib/duration/create.js
src/lib/duration/get.js
src/lib/duration/humanize.js
src/lib/duration/iso-string.js
src/lib/duration/valid.js
src/lib/format/format.js
src/lib/locale/lists.js
src/lib/locale/locales.js
src/lib/locale/ordinal.js
src/lib/moment/add-subtract.js
src/lib/moment/calendar.js
src/lib/moment/constructor.js
src/lib/moment/diff.js
src/lib/moment/format.js
src/lib/moment/get-set.js
src/lib/moment/min-max.js
src/lib/moment/prototype.js
src/lib/moment/start-end-of.js
src/lib/parse/regex.js
src/lib/units/constants.js
src/lib/units/day-of-week.js
src/lib/units/hour.js
src/lib/units/millisecond.js
src/lib/units/month.js
src/lib/units/offset.js
src/lib/units/priorities.js
src/lib/utils/deprecate.js
src/lib/utils/is-calendar-spec.js
src/lib/utils/is-moment-input.js
src/lib/utils/is-object-empty.js
src/lib/utils/some.js
src/locale/cs.js
src/locale/es-do.js
src/locale/es-us.js
src/locale/es.js
src/locale/ga.js
src/locale/gd.js
src/locale/hu.js
src/locale/nl-be.js
src/locale/nl.js
src/locale/sd.js
src/locale/sk.js
src/locale/uk.js
src/locale/ur.js
src/test/helpers/common-locale.js
src/test/helpers/has-own-prop.js [new file with mode: 0644]
src/test/helpers/object-keys.js
src/test/locale/en.js
src/test/locale/fa.js
src/test/locale/ga.js
src/test/locale/gd.js
src/test/locale/ja.js
src/test/locale/sd.js
src/test/locale/ur.js
src/test/moment/calendar.js
src/test/moment/create.js
src/test/moment/creation-data.js
src/test/moment/deprecate.js
src/test/moment/diff.js
src/test/moment/duration.js
src/test/moment/duration_invalid.js
src/test/moment/format.js
src/test/moment/getters_setters.js
src/test/moment/instanceof.js
src/test/moment/is_array.js
src/test/moment/is_between.js
src/test/moment/is_number.js
src/test/moment/is_valid.js
src/test/moment/listers.js
src/test/moment/locale.js
src/test/moment/normalize_units.js
src/test/moment/now.js
src/test/moment/relative_time.js
src/test/moment/to_type.js
src/test/moment/zones.js
src/test/qunit.js
tasks/qtest.js
tasks/transpile.js

index 41b539fb7338e18325d9d422a56a86baf172c2d6..1ef5acc8d91ad950ed155870a33c412f6ae11e5e 100644 (file)
@@ -3,8 +3,8 @@ import { YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND, WEEK, WEEKDAY } f
 import getParsingFlags from '../create/parsing-flags';
 
 export default function checkOverflow (m) {
-    var overflow;
-    var a = m._a;
+    var overflow,
+     a = m._a;
 
     if (a && getParsingFlags(m).overflow === -2) {
         overflow =
index 7fabbc05f183b96bbbee3a7dafea6c67dd3d8c2d..c391f6dff00320dc8288ca27639c0b4494d7c8f3 100644 (file)
@@ -17,10 +17,10 @@ export function createDate (y, m, d, h, M, s, ms) {
 }
 
 export function createUTCDate (y) {
-    var date;
+    var date, args;
     // the Date.UTC function remaps years 0-99 to 1900-1999
     if (y < 100 && y >= 0) {
-        var args = Array.prototype.slice.call(arguments);
+        args = Array.prototype.slice.call(arguments);
         // preserve leap years using a full 400 year cycle, then reset
         args[0] = y + 400;
         date = new Date(Date.UTC.apply(null, args));
index 548992f73dc6659cb106b22e98a633bdffda83a6..e4d4fdc4b8988d118490bfb6438ac78bbd5ab5d1 100644 (file)
@@ -90,7 +90,7 @@ export function configFromArray (config) {
 }
 
 function dayOfYearFromWeekInfo(config) {
-    var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
+    var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
 
     w = config._w;
     if (w.GG != null || w.W != null || w.E != null) {
@@ -111,7 +111,7 @@ function dayOfYearFromWeekInfo(config) {
         dow = config._locale._week.dow;
         doy = config._locale._week.doy;
 
-        var curWeek = weekOfYear(createLocal(), dow, doy);
+        curWeek = weekOfYear(createLocal(), dow, doy);
 
         weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
 
index eb57d51d35486905998dd1ca91483294709c1ebd..ee3a44103e41b59f1a2bc1e8ae2611763049be06 100644 (file)
@@ -7,9 +7,9 @@ export function configFromObject(config) {
         return;
     }
 
-    var i = normalizeObjectUnits(config._i);
+    var i = normalizeObjectUnits(config._i),
 
-    var dayOrDate = i.day === undefined ? i.date : i.day;
+     dayOrDate = i.day === undefined ? i.date : i.day;
     config._a = map([i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) {
         return obj && parseInt(obj, 10);
     });
index c3fd999f47ed4617703ab3bf92c2b503717f2311..4dd7ed9ad36d80df33a252430a6b5e6a883862ba 100644 (file)
@@ -8,41 +8,56 @@ import {defaultLocaleWeekdaysShort} from '../units/day-of-week';
 
 // iso 8601 regex
 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
-var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
-var basicIsoRegex =    /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
-
-var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
-
-var isoDates = [
-    ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
-    ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
-    ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
-    ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
-    ['YYYY-DDD', /\d{4}-\d{3}/],
-    ['YYYY-MM', /\d{4}-\d\d/, false],
-    ['YYYYYYMMDD', /[+-]\d{10}/],
-    ['YYYYMMDD', /\d{8}/],
-    ['GGGG[W]WWE', /\d{4}W\d{3}/],
-    ['GGGG[W]WW', /\d{4}W\d{2}/, false],
-    ['YYYYDDD', /\d{7}/],
-    ['YYYYMM', /\d{6}/, false],
-    ['YYYY', /\d{4}/, false]
-];
-
-// iso time formats and regexes
-var isoTimes = [
-    ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
-    ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
-    ['HH:mm:ss', /\d\d:\d\d:\d\d/],
-    ['HH:mm', /\d\d:\d\d/],
-    ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
-    ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
-    ['HHmmss', /\d\d\d\d\d\d/],
-    ['HHmm', /\d\d\d\d/],
-    ['HH', /\d\d/]
-];
-
-var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
+var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
+    basicIsoRegex =    /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
+
+    tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
+
+    isoDates = [
+        ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
+        ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
+        ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
+        ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
+        ['YYYY-DDD', /\d{4}-\d{3}/],
+        ['YYYY-MM', /\d{4}-\d\d/, false],
+        ['YYYYYYMMDD', /[+-]\d{10}/],
+        ['YYYYMMDD', /\d{8}/],
+        ['GGGG[W]WWE', /\d{4}W\d{3}/],
+        ['GGGG[W]WW', /\d{4}W\d{2}/, false],
+        ['YYYYDDD', /\d{7}/],
+        ['YYYYMM', /\d{6}/, false],
+        ['YYYY', /\d{4}/, false]
+    ],
+
+    // iso time formats and regexes
+    isoTimes = [
+        ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
+        ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
+        ['HH:mm:ss', /\d\d:\d\d:\d\d/],
+        ['HH:mm', /\d\d:\d\d/],
+        ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
+        ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
+        ['HHmmss', /\d\d\d\d\d\d/],
+        ['HHmm', /\d\d\d\d/],
+        ['HH', /\d\d/]
+    ],
+
+    aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
+    // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
+    rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
+    obsOffsets = {
+        UT: 0,
+        GMT: 0,
+        EDT: -4 * 60,
+        EST: -5 * 60,
+        CDT: -5 * 60,
+        CST: -6 * 60,
+        MDT: -6 * 60,
+        MST: -7 * 60,
+        PDT: -7 * 60,
+        PST: -8 * 60
+    };
+
 
 // date from iso format
 export function configFromISO(config) {
@@ -97,8 +112,6 @@ export function configFromISO(config) {
     }
 }
 
-// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
-var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
 
 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
     var result = [
@@ -145,19 +158,6 @@ function checkWeekday(weekdayStr, parsedInput, config) {
     return true;
 }
 
-var obsOffsets = {
-    UT: 0,
-    GMT: 0,
-    EDT: -4 * 60,
-    EST: -5 * 60,
-    CDT: -5 * 60,
-    CST: -6 * 60,
-    MDT: -6 * 60,
-    MST: -7 * 60,
-    PDT: -7 * 60,
-    PST: -8 * 60
-};
-
 function calculateOffset(obsOffset, militaryOffset, numOffset) {
     if (obsOffset) {
         return obsOffsets[obsOffset];
@@ -165,17 +165,17 @@ function calculateOffset(obsOffset, militaryOffset, numOffset) {
         // the only allowed military tz is Z
         return 0;
     } else {
-        var hm = parseInt(numOffset, 10);
-        var m = hm % 100, h = (hm - m) / 100;
+        var hm = parseInt(numOffset, 10),
+         m = hm % 100, h = (hm - m) / 100;
         return h * 60 + m;
     }
 }
 
 // date and time from ref 2822 format
 export function configFromRFC2822(config) {
-    var match = rfc2822.exec(preprocessRFC2822(config._i));
+    var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray;
     if (match) {
-        var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
+        parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
         if (!checkWeekday(match[1], parsedArray, config)) {
             return;
         }
index d13f12f8b896da422fc8a8c043c8afaa7fce2834..847e90ca4be3caa25b63bd645ad0ec1184d2e677 100644 (file)
@@ -5,11 +5,11 @@ import some from '../utils/some';
 
 export function isValid(m) {
     if (m._isValid == null) {
-        var flags = getParsingFlags(m);
-        var parsedParts = some.call(flags.parsedDateParts, function (i) {
+        var flags = getParsingFlags(m),
+         parsedParts = some.call(flags.parsedDateParts, function (i) {
             return i != null;
-        });
-        var isNowValid = !isNaN(m._d.getTime()) &&
+        }),
+         isNowValid = !isNaN(m._d.getTime()) &&
             flags.overflow < 0 &&
             !flags.empty &&
             !flags.invalidMonth &&
index fe51a98884bdafd275034b6ab584857adf611dbb..13eb865f941e06ac3b0cdc06ba6fb3a89c8c50e9 100644 (file)
@@ -6,9 +6,9 @@ export function as (units) {
     if (!this.isValid()) {
         return NaN;
     }
-    var days;
-    var months;
-    var milliseconds = this._milliseconds;
+    var days,
+     months,
+     milliseconds = this._milliseconds;
 
     units = normalizeUnits(units);
 
@@ -55,12 +55,24 @@ function makeAs (alias) {
     };
 }
 
-export var asMilliseconds = makeAs('ms');
-export var asSeconds      = makeAs('s');
-export var asMinutes      = makeAs('m');
-export var asHours        = makeAs('h');
-export var asDays         = makeAs('d');
-export var asWeeks        = makeAs('w');
-export var asMonths       = makeAs('M');
-export var asQuarters     = makeAs('Q');
-export var asYears        = makeAs('y');
+var asMilliseconds = makeAs('ms'),
+    asSeconds      = makeAs('s'),
+    asMinutes      = makeAs('m'),
+    asHours        = makeAs('h'),
+    asDays         = makeAs('d'),
+    asWeeks        = makeAs('w'),
+    asMonths       = makeAs('M'),
+    asQuarters     = makeAs('Q'),
+    asYears        = makeAs('y');
+
+export {
+    asMilliseconds,
+    asSeconds,
+    asMinutes,
+    asHours,
+    asDays,
+    asWeeks,
+    asMonths,
+    asQuarters,
+    asYears
+}
index d13316a220896ebd957f0b51bc22fbccc8ffe90e..3aa995492a5e63b651d498c804da20ad40764ad6 100644 (file)
@@ -2,11 +2,11 @@ import absFloor from '../utils/abs-floor';
 import absCeil from '../utils/abs-ceil';
 
 export function bubble () {
-    var milliseconds = this._milliseconds;
-    var days         = this._days;
-    var months       = this._months;
-    var data         = this._data;
-    var seconds, minutes, hours, years, monthsFromDays;
+    var milliseconds = this._milliseconds,
+     days         = this._days,
+     months       = this._months,
+     data         = this._data,
+     seconds, minutes, hours, years, monthsFromDays;
 
     // if we have a mix of positive and negative values, bubble down first
     // check: https://github.com/moment/moment/issues/2166
index b5d03cdbeca4d77b3feed645dd220ce60d3d649f..d3cb92a1f3e00d8c610aecb713ed24d545284547 100644 (file)
@@ -9,12 +9,12 @@ import { createLocal } from '../create/local';
 import { createInvalid as invalid } from './valid';
 
 // ASP.NET json date format regex
-var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
+var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
 
 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
 // and further modified to allow for strings containing both week and day
-var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
+ isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
 
 export function createDuration (input, key) {
     var duration = input,
@@ -37,7 +37,7 @@ export function createDuration (input, key) {
         } else {
             duration.milliseconds = +input;
         }
-    } else if (!!(match = aspNetRegex.exec(input))) {
+    } else if ((match = aspNetRegex.exec(input))) {
         sign = (match[1] === '-') ? -1 : 1;
         duration = {
             y  : 0,
@@ -47,7 +47,7 @@ export function createDuration (input, key) {
             s  : toInt(match[SECOND])                       * sign,
             ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
         };
-    } else if (!!(match = isoRegex.exec(input))) {
+    } else if ((match = isoRegex.exec(input))) {
         sign = (match[1] === '-') ? -1 : 1;
         duration = {
             y : parseIso(match[2], sign),
index 8993e07443b886e9fef7bb7bed179b399ef99321..d45906c3792192af86ecb9fc7bb1298bd9401b77 100644 (file)
@@ -12,13 +12,23 @@ function makeGetter(name) {
     };
 }
 
-export var milliseconds = makeGetter('milliseconds');
-export var seconds      = makeGetter('seconds');
-export var minutes      = makeGetter('minutes');
-export var hours        = makeGetter('hours');
-export var days         = makeGetter('days');
-export var months       = makeGetter('months');
-export var years        = makeGetter('years');
+var milliseconds = makeGetter('milliseconds'),
+    seconds      = makeGetter('seconds'),
+    minutes      = makeGetter('minutes'),
+    hours        = makeGetter('hours'),
+    days         = makeGetter('days'),
+    months       = makeGetter('months'),
+    years        = makeGetter('years');
+
+export {
+    milliseconds,
+    seconds,
+    minutes,
+    hours,
+    days,
+    months,
+    years
+}
 
 export function weeks () {
     return absFloor(this.days() / 7);
index e0e3d8a6c2c961fcc84bd772aa14b1431f8de306..a4f3898f783c5f32d889f00c8ce08e00fd5d1cdc 100644 (file)
@@ -1,7 +1,7 @@
 import { createDuration } from './create';
 
-var round = Math.round;
-var thresholds = {
+var round = Math.round,
+ thresholds = {
     ss: 44,         // a few seconds to seconds
     s : 45,         // seconds to minute
     m : 45,         // minutes to hour
@@ -17,16 +17,16 @@ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
 }
 
 function relativeTime (posNegDuration, withoutSuffix, thresholds, locale) {
-    var duration = createDuration(posNegDuration).abs();
-    var seconds  = round(duration.as('s'));
-    var minutes  = round(duration.as('m'));
-    var hours    = round(duration.as('h'));
-    var days     = round(duration.as('d'));
-    var months   = round(duration.as('M'));
-    var weeks    = round(duration.as('w'));
-    var years    = round(duration.as('y'));
+    var duration = createDuration(posNegDuration).abs(),
+     seconds  = round(duration.as('s')),
+     minutes  = round(duration.as('m')),
+     hours    = round(duration.as('h')),
+     days     = round(duration.as('d')),
+     months   = round(duration.as('M')),
+     weeks    = round(duration.as('w')),
+     years    = round(duration.as('y')),
 
-    var a = seconds <= thresholds.ss && ['s', seconds]  ||
+     a = seconds <= thresholds.ss && ['s', seconds]  ||
             seconds < thresholds.s   && ['ss', seconds] ||
             minutes <= 1             && ['m']           ||
             minutes < thresholds.m   && ['mm', minutes] ||
@@ -83,19 +83,20 @@ export function humanize (withSuffixOrOptions) {
         return this.localeData().invalidDate();
     }
 
-    var withSuffix = false;
-    var th = thresholds;
+    var withSuffix = false,
+        th = thresholds,
+        ws, t, locale, output;
 
     if (typeof withSuffixOrOptions === 'boolean') {
         withSuffix = withSuffixOrOptions;
     }
     else if (typeof withSuffixOrOptions === 'object') {
-        var ws = withSuffixOrOptions.withSuffix;
+        ws = withSuffixOrOptions.withSuffix;
         if (typeof ws === 'boolean') {
             withSuffix = ws;
         }
 
-        var t = withSuffixOrOptions.thresholds;
+        t = withSuffixOrOptions.thresholds;
         if (typeof t === 'object') {
             // Fill in missing keys with the current values
             th = Object.assign({}, thresholds, t);
@@ -105,8 +106,8 @@ export function humanize (withSuffixOrOptions) {
         }
     }
 
-    var locale = this.localeData();
-    var output = relativeTime(this, !withSuffix, th, locale);
+    locale = this.localeData();
+    output = relativeTime(this, !withSuffix, th, locale);
 
     if (withSuffix) {
         output = locale.pastFuture(+this, output);
index 419f3638e6e390e838a332552799208eb474c481..1cbc304ee097b930ce48b13179b28e22ed4c7fb7 100644 (file)
@@ -17,10 +17,17 @@ export function toISOString() {
         return this.localeData().invalidDate();
     }
 
-    var seconds = abs(this._milliseconds) / 1000;
-    var days         = abs(this._days);
-    var months       = abs(this._months);
-    var minutes, hours, years;
+    var seconds = abs(this._milliseconds) / 1000,
+        days         = abs(this._days),
+        months       = abs(this._months),
+        minutes, hours, years, s, total = this.asSeconds(),
+        totalSign, ymSign, daysSign, hmsSign;
+
+    if (!total) {
+        // this is the same as C#'s (Noda) and python (isodate)...
+        // but not other JS (goog.date)
+        return 'P0D';
+    }
 
     // 3600 seconds -> 60 minutes -> 1 hour
     minutes           = absFloor(seconds / 60);
@@ -34,31 +41,19 @@ export function toISOString() {
 
 
     // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
-    var Y = years;
-    var M = months;
-    var D = days;
-    var h = hours;
-    var m = minutes;
-    var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
-    var total = this.asSeconds();
-
-    if (!total) {
-        // this is the same as C#'s (Noda) and python (isodate)...
-        // but not other JS (goog.date)
-        return 'P0D';
-    }
+    s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
 
-    var totalSign = total < 0 ? '-' : '';
-    var ymSign = sign(this._months) !== sign(total) ? '-' : '';
-    var daysSign = sign(this._days) !== sign(total) ? '-' : '';
-    var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
+    totalSign = total < 0 ? '-' : '';
+    ymSign = sign(this._months) !== sign(total) ? '-' : '';
+    daysSign = sign(this._days) !== sign(total) ? '-' : '';
+    hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
 
     return totalSign + 'P' +
-        (Y ? ymSign + Y + 'Y' : '') +
-        (M ? ymSign + M + 'M' : '') +
-        (D ? daysSign + D + 'D' : '') +
-        ((h || m || s) ? 'T' : '') +
-        (h ? hmsSign + h + 'H' : '') +
-        (m ? hmsSign + m + 'M' : '') +
-        (s ? hmsSign + s + 'S' : '');
+        (years ? ymSign + years + 'Y' : '') +
+        (months ? ymSign + months + 'M' : '') +
+        (days ? daysSign + days + 'D' : '') +
+        ((hours || minutes || seconds) ? 'T' : '') +
+        (hours ? hmsSign + hours + 'H' : '') +
+        (minutes ? hmsSign + minutes + 'M' : '') +
+        (seconds ? hmsSign + s + 'S' : '');
 }
index 7c57c64c20fe9d583f9ddd8e1eac4964f6ade492..30da6df17d06a9aaf05594e1e25636e2fbec5556 100644 (file)
@@ -1,20 +1,19 @@
 import hasOwnProp from '../utils/has-own-prop';
 import toInt from '../utils/to-int';
 import indexOf from '../utils/index-of';
-import {Duration} from './constructor';
 import {createDuration} from './create';
 
 var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
 
 export default function isDurationValid(m) {
-    for (var key in m) {
+    var key, unitHasDecimal = false, i;
+    for (key in m) {
         if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
             return false;
         }
     }
 
-    var unitHasDecimal = false;
-    for (var i = 0; i < ordering.length; ++i) {
+    for (i = 0; i < ordering.length; ++i) {
         if (m[ordering[i]]) {
             if (unitHasDecimal) {
                 return false; // only allow non-integers for smallest unit
index 03f5c584fc0b074c12bf8aa7ecbced54d9dc0c2e..891ad2939d50f66214b492db4eb84778468e10ef 100644 (file)
@@ -1,13 +1,15 @@
 import zeroFill from '../utils/zero-fill';
 import isFunction from '../utils/is-function';
 
-export var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
-
-var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
-
-var formatFunctions = {};
-
-export var formatTokenFunctions = {};
+var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
+    localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
+    formatFunctions = {},
+    formatTokenFunctions = {};
+
+export {
+    formattingTokens,
+    formatTokenFunctions
+}
 
 // token:    'M'
 // padded:   ['MM', 2]
index 42f7572e2a9253dd353633ee0e66c48d80055828..7a12ae1061fe35ce8635d16c0ba198227a4bd9e8 100644 (file)
@@ -3,8 +3,8 @@ import { getLocale } from './locales';
 import { createUTC } from '../create/utc';
 
 function get (format, index, field, setter) {
-    var locale = getLocale();
-    var utc = createUTC().set(setter, index);
+    var locale = getLocale(),
+     utc = createUTC().set(setter, index);
     return locale[field](utc, format);
 }
 
@@ -20,8 +20,8 @@ function listMonthsImpl (format, index, field) {
         return get(format, index, field, 'month');
     }
 
-    var i;
-    var out = [];
+    var i,
+     out = [];
     for (i = 0; i < 12; i++) {
         out[i] = get(format, i, field, 'month');
     }
@@ -58,14 +58,13 @@ function listWeekdaysImpl (localeSorted, format, index, field) {
     }
 
     var locale = getLocale(),
-        shift = localeSorted ? locale._week.dow : 0;
+        shift = localeSorted ? locale._week.dow : 0,
+        i, out = [];
 
     if (index != null) {
         return get(format, (index + shift) % 7, field, 'day');
     }
 
-    var i;
-    var out = [];
     for (i = 0; i < 7; i++) {
         out[i] = get(format, (i + shift) % 7, field, 'day');
     }
index ef9dd2b25aa82fb7ec86beab80d3dd50ddd3d691..e789e4e76fe8184f4e93ea6a729cf06c689a97b3 100644 (file)
@@ -8,9 +8,9 @@ import keys from '../utils/keys';
 import { baseConfig } from './base-config';
 
 // internal storage for locale config files
-var locales = {};
-var localeFamilies = {};
-var globalLocale;
+var locales = {},
+ localeFamilies = {},
+ globalLocale;
 
 function commonPrefix(arr1, arr2) {
     var i, minl = Math.min(arr1.length, arr2.length);
@@ -54,13 +54,13 @@ function chooseLocale(names) {
 }
 
 function loadLocale(name) {
-    var oldLocale = null;
+    var oldLocale = null, aliasedRequire;
     // TODO: Find a better way to register and load all the locales in Node
     if (locales[name] === undefined && (typeof module !== 'undefined') &&
             module && module.exports) {
         try {
             oldLocale = globalLocale._abbr;
-            var aliasedRequire = require;
+            aliasedRequire = require;
             aliasedRequire((typeof __dirname !== undefined ? __dirname : '.') + '/locale/' + name);
             getSetGlobalLocale(oldLocale);
         } catch (e) {
index e2efc05a236b35da2a8d861855742658be4b7b60..f11dbd7f37c19dfd2923cad9f5f8060919ecee3d 100644 (file)
@@ -1,5 +1,10 @@
-export var defaultOrdinal = '%d';
-export var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
+var defaultOrdinal = '%d',
+    defaultDayOfMonthOrdinalParse = /\d{1,2}/;
+
+export {
+    defaultOrdinal,
+    defaultDayOfMonthOrdinalParse
+}
 
 export function ordinal (number) {
     return this._ordinal.replace('%d', number);
index 4818ed6b8275323dcc75626a10b713cc7232bbad..0bb6ab0faec201cccf11142c85e54fd8f615f956 100644 (file)
@@ -49,6 +49,6 @@ export function addSubtract (mom, duration, isAdding, updateOffset) {
     }
 }
 
-export var add      = createAdder(1, 'add');
-export var subtract = createAdder(-1, 'subtract');
+export var add = createAdder(1, 'add'),
+    subtract = createAdder(-1, 'subtract');
 
index 5abb9745b6e7dafddc466e4bc71af67d94d7b176..522518df623d6b16ced1b0b23af35327826fa847 100644 (file)
@@ -30,9 +30,9 @@ export function calendar (time, formats) {
     // Getting start-of-today depends on whether we're local/utc/offset or not.
     var now = time || createLocal(),
         sod = cloneWithOffset(now, this).startOf('day'),
-        format = hooks.calendarFormat(this, sod) || 'sameElse';
+        format = hooks.calendarFormat(this, sod) || 'sameElse',
 
-    var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
+     output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
 
     return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
 }
index 17ccccfc3e90f6bcaf747f942d0832330adf461a..a10d0bbda331b3d0617bb6e48abc84d24abb64c0 100644 (file)
@@ -4,7 +4,8 @@ import getParsingFlags from '../create/parsing-flags';
 
 // Plugins that add properties should also add the key here (null value),
 // so we can properly clone ourselves.
-var momentProperties = hooks.momentProperties = [];
+var momentProperties = hooks.momentProperties = [],
+    updateInProgress = false;
 
 export function copyConfig(to, from) {
     var i, prop, val;
@@ -53,8 +54,6 @@ export function copyConfig(to, from) {
     return to;
 }
 
-var updateInProgress = false;
-
 // Moment prototype object
 export function Moment(config) {
     copyConfig(this, config);
index 85254dfc69884b76be8c7abf0ecfea1c43fe2642..a450741d168204a4991d4931ef8681f125d539df 100644 (file)
@@ -5,7 +5,7 @@ import { normalizeUnits } from '../units/aliases';
 export function diff (input, units, asFloat) {
     var that,
         zoneDelta,
-        delta, output;
+        output;
 
     if (!this.isValid()) {
         return NaN;
index 9544f5173a41989933caaaaa18aa478eb470009f..1d5ba864a3e01fe2f73d95514000b446d778e863 100644 (file)
@@ -13,8 +13,8 @@ export function toISOString(keepOffset) {
     if (!this.isValid()) {
         return null;
     }
-    var utc = keepOffset !== true;
-    var m = utc ? this.clone().utc() : this;
+    var utc = keepOffset !== true,
+     m = utc ? this.clone().utc() : this;
     if (m.year() < 0 || m.year() > 9999) {
         return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
     }
@@ -39,16 +39,16 @@ export function inspect () {
     if (!this.isValid()) {
         return 'moment.invalid(/* ' + this._i + ' */)';
     }
-    var func = 'moment';
-    var zone = '';
+    var func = 'moment',
+     zone = '', prefix, year, datetime, suffix;
     if (!this.isLocal()) {
         func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
         zone = 'Z';
     }
-    var prefix = '[' + func + '("]';
-    var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
-    var datetime = '-MM-DD[T]HH:mm:ss.SSS';
-    var suffix = zone + '[")]';
+    prefix = '[' + func + '("]';
+    year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
+    datetime = '-MM-DD[T]HH:mm:ss.SSS';
+    suffix = zone + '[")]';
 
     return this.format(prefix + year + datetime + suffix);
 }
index a3274b2b92d308f82c9f6b7ac996134f2436fc3e..166bbb0806797cd7f648f9a96921aef07e56cb50 100644 (file)
@@ -49,8 +49,8 @@ export function stringGet (units) {
 export function stringSet (units, value) {
     if (typeof units === 'object') {
         units = normalizeObjectUnits(units);
-        var prioritized = getPrioritizedUnits(units);
-        for (var i = 0; i < prioritized.length; i++) {
+        var prioritized = getPrioritizedUnits(units), i;
+        for (i = 0; i < prioritized.length; i++) {
             this[prioritized[i].unit](units[prioritized[i].unit]);
         }
     } else {
index d76920a7124127255f16e37f74bcacb1eb49d4cc..fd76379a462e8808d3b275ea4de5d40667b59acd 100644 (file)
@@ -13,19 +13,18 @@ export var prototypeMin = deprecate(
             return createInvalid();
         }
     }
-);
-
-export var prototypeMax = deprecate(
-    'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
-    function () {
-        var other = createLocal.apply(null, arguments);
-        if (this.isValid() && other.isValid()) {
-            return other > this ? this : other;
-        } else {
-            return createInvalid();
+),
+    prototypeMax = deprecate(
+        'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
+        function () {
+            var other = createLocal.apply(null, arguments);
+            if (this.isValid() && other.isValid()) {
+                return other > this ? this : other;
+            } else {
+                return createInvalid();
+            }
         }
-    }
-);
+    );
 
 // Pick a moment m from moments so that m[fn](other) is true for all
 // other. This relies on the function fn to be transitive.
index 1d0d08d14e937bd7dca4699f235881e592238503..bc6134870f1d7df01090eb663ad33e1340b3ec04 100644 (file)
@@ -3,7 +3,7 @@ import { Moment } from './constructor';
 var proto = Moment.prototype;
 
 import { add, subtract } from './add-subtract';
-import { calendar, getCalendarFormat } from './calendar';
+import { calendar } from './calendar';
 import { clone } from './clone';
 import { isBefore, isBetween, isSame, isAfter, isSameOrAfter, isSameOrBefore } from './compare';
 import { diff } from './diff';
index 42c19cbc3b7e9597722c277105acebbad41f314e..ffa16c3cac0d66030e4fb99f5ffbe0256db23e7b 100644 (file)
@@ -1,10 +1,10 @@
 import { normalizeUnits } from '../units/aliases';
 import { hooks } from '../utils/hooks';
 
-var MS_PER_SECOND = 1000;
-var MS_PER_MINUTE = 60 * MS_PER_SECOND;
-var MS_PER_HOUR = 60 * MS_PER_MINUTE;
-var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
+var MS_PER_SECOND = 1000,
+ MS_PER_MINUTE = 60 * MS_PER_SECOND,
+ MS_PER_HOUR = 60 * MS_PER_MINUTE,
+ MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
 
 // actual modulo - handles negative numbers (for dates before 1970):
 function mod(dividend, divisor) {
@@ -32,13 +32,13 @@ function utcStartOfDate(y, m, d) {
 }
 
 export function startOf (units) {
-    var time;
+    var time, startOfDate;
     units = normalizeUnits(units);
     if (units === undefined || units === 'millisecond' || !this.isValid()) {
         return this;
     }
 
-    var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
+    startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
 
     switch (units) {
         case 'year':
@@ -80,13 +80,13 @@ export function startOf (units) {
 }
 
 export function endOf (units) {
-    var time;
+    var time, startOfDate;
     units = normalizeUnits(units);
     if (units === undefined || units === 'millisecond' || !this.isValid()) {
         return this;
     }
 
-    var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
+    startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
 
     switch (units) {
         case 'year':
index 4b86f34c7dd6e94da064da271f9718a912ca3aa8..974aef805c10c7ee7be3f28b5752cf2a4c405a5a 100644 (file)
@@ -1,32 +1,38 @@
-export var match1         = /\d/;            //       0 - 9
-export var match2         = /\d\d/;          //      00 - 99
-export var match3         = /\d{3}/;         //     000 - 999
-export var match4         = /\d{4}/;         //    0000 - 9999
-export var match6         = /[+-]?\d{6}/;    // -999999 - 999999
-export var match1to2      = /\d\d?/;         //       0 - 99
-export var match3to4      = /\d\d\d\d?/;     //     999 - 9999
-export var match5to6      = /\d\d\d\d\d\d?/; //   99999 - 999999
-export var match1to3      = /\d{1,3}/;       //       0 - 999
-export var match1to4      = /\d{1,4}/;       //       0 - 9999
-export var match1to6      = /[+-]?\d{1,6}/;  // -999999 - 999999
-
-export var matchUnsigned  = /\d+/;           //       0 - inf
-export var matchSigned    = /[+-]?\d+/;      //    -inf - inf
-
-export var matchOffset    = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
-export var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
-
-export var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
-
-// any word (or two) characters or numbers including two/three word month in arabic.
-// includes scottish gaelic two word and hyphenated months
-export var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
-
+var match1         = /\d/,            //       0 - 9
+    match2         = /\d\d/,          //      00 - 99
+    match3         = /\d{3}/,         //     000 - 999
+    match4         = /\d{4}/,         //    0000 - 9999
+    match6         = /[+-]?\d{6}/,    // -999999 - 999999
+    match1to2      = /\d\d?/,         //       0 - 99
+    match3to4      = /\d\d\d\d?/,     //     999 - 9999
+    match5to6      = /\d\d\d\d\d\d?/, //   99999 - 999999
+    match1to3      = /\d{1,3}/,       //       0 - 999
+    match1to4      = /\d{1,4}/,       //       0 - 9999
+    match1to6      = /[+-]?\d{1,6}/,  // -999999 - 999999
+
+    matchUnsigned  = /\d+/,           //       0 - inf
+    matchSigned    = /[+-]?\d+/,      //    -inf - inf
+
+    matchOffset    = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
+    matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
+
+    matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
+
+    // any word (or two) characters or numbers including two/three word month in arabic.
+    // includes scottish gaelic two word and hyphenated months
+    matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
+    regexes
+
+export {
+    match1, match2, match3, match4, match6, match1to2, match3to4, match5to6,
+    match1to3, match1to4, match1to6, matchUnsigned, matchSigned, matchOffset,
+    matchShortOffset, matchTimestamp, matchWord
+}
 
 import hasOwnProp from '../utils/has-own-prop';
 import isFunction from '../utils/is-function';
 
-var regexes = {};
+regexes = {};
 
 export function addRegexToken (token, regex, strictRegex) {
     regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
index 70bf1b26ede2c1fcb9e0ce1a1f6a36142d32312a..da36dbdc4ae61d1020a59ee2573ca64569f10be9 100644 (file)
@@ -1,9 +1,9 @@
-export var YEAR = 0;
-export var MONTH = 1;
-export var DATE = 2;
-export var HOUR = 3;
-export var MINUTE = 4;
-export var SECOND = 5;
-export var MILLISECOND = 6;
-export var WEEK = 7;
-export var WEEKDAY = 8;
+export var YEAR = 0,
+    MONTH = 1,
+    DATE = 2,
+    HOUR = 3,
+    MINUTE = 4,
+    SECOND = 5,
+    MILLISECOND = 6,
+    WEEK = 7,
+    WEEKDAY = 8;
index e4c449825e2973e661c58d06aff697a7b865ae5f..ea161d31cb245531d5ec910d742364cad04a4df2 100644 (file)
@@ -100,7 +100,19 @@ function shiftWeekdays (ws, n) {
     return ws.slice(n, 7).concat(ws.slice(0, n));
 }
 
-export var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
+var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+    defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+    defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+    defaultWeekdaysRegex = matchWord,
+    defaultWeekdaysShortRegex = matchWord,
+    defaultWeekdaysMinRegex = matchWord;
+
+export {
+    defaultLocaleWeekdays,
+    defaultLocaleWeekdaysShort,
+    defaultLocaleWeekdaysMin
+}
+
 export function localeWeekdays (m, format) {
     var weekdays = isArray(this._weekdays) ? this._weekdays :
         this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
@@ -108,13 +120,11 @@ export function localeWeekdays (m, format) {
         : (m) ? weekdays[m.day()] : weekdays;
 }
 
-export var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
 export function localeWeekdaysShort (m) {
     return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
         : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
 }
 
-export var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
 export function localeWeekdaysMin (m) {
     return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
         : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
@@ -264,7 +274,6 @@ export function getSetISODayOfWeek (input) {
     }
 }
 
-var defaultWeekdaysRegex = matchWord;
 export function weekdaysRegex (isStrict) {
     if (this._weekdaysParseExact) {
         if (!hasOwnProp(this, '_weekdaysRegex')) {
@@ -284,7 +293,6 @@ export function weekdaysRegex (isStrict) {
     }
 }
 
-var defaultWeekdaysShortRegex = matchWord;
 export function weekdaysShortRegex (isStrict) {
     if (this._weekdaysParseExact) {
         if (!hasOwnProp(this, '_weekdaysRegex')) {
@@ -304,7 +312,6 @@ export function weekdaysShortRegex (isStrict) {
     }
 }
 
-var defaultWeekdaysMinRegex = matchWord;
 export function weekdaysMinRegex (isStrict) {
     if (this._weekdaysParseExact) {
         if (!hasOwnProp(this, '_weekdaysRegex')) {
index d717a7999041271bc5d1464487e9fd11f842a297..88457c98f87a9fc033495ce25b78729bbf407058 100644 (file)
@@ -97,8 +97,8 @@ addParseToken('hmm', function (input, array, config) {
     getParsingFlags(config).bigHour = true;
 });
 addParseToken('hmmss', function (input, array, config) {
-    var pos1 = input.length - 4;
-    var pos2 = input.length - 2;
+    var pos1 = input.length - 4,
+     pos2 = input.length - 2;
     array[HOUR] = toInt(input.substr(0, pos1));
     array[MINUTE] = toInt(input.substr(pos1, 2));
     array[SECOND] = toInt(input.substr(pos2));
@@ -110,8 +110,8 @@ addParseToken('Hmm', function (input, array, config) {
     array[MINUTE] = toInt(input.substr(pos));
 });
 addParseToken('Hmmss', function (input, array, config) {
-    var pos1 = input.length - 4;
-    var pos2 = input.length - 2;
+    var pos1 = input.length - 4,
+     pos2 = input.length - 2;
     array[HOUR] = toInt(input.substr(0, pos1));
     array[MINUTE] = toInt(input.substr(pos1, 2));
     array[SECOND] = toInt(input.substr(pos2));
@@ -125,7 +125,13 @@ export function localeIsPM (input) {
     return ((input + '').toLowerCase().charAt(0) === 'p');
 }
 
-export var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
+export var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
+    // Setting the hour should keep the time, because the user explicitly
+    // specified which hour they want. So trying to maintain the same hour (in
+    // a new timezone) makes sense. Adding/subtracting hours does not follow
+    // this rule.
+    getSetHour = makeGetSet('Hours', true);
+
 export function localeMeridiem (hours, minutes, isLower) {
     if (hours > 11) {
         return isLower ? 'pm' : 'PM';
@@ -133,12 +139,3 @@ export function localeMeridiem (hours, minutes, isLower) {
         return isLower ? 'am' : 'AM';
     }
 }
-
-
-// MOMENTS
-
-// Setting the hour should keep the time, because the user explicitly
-// specified which hour they want. So trying to maintain the same hour (in
-// a new timezone) makes sense. Adding/subtracting hours does not follow
-// this rule.
-export var getSetHour = makeGetSet('Hours', true);
index 27c951269360e0498145fbf04d6c6de4e7950144..4ce099b36522a4c5cc71a80f3ffa1cf92a6392cc 100644 (file)
@@ -52,7 +52,7 @@ addRegexToken('S',    match1to3, match1);
 addRegexToken('SS',   match1to3, match2);
 addRegexToken('SSS',  match1to3, match3);
 
-var token;
+var token, getSetMillisecond;
 for (token = 'SSSS'; token.length <= 9; token += 'S') {
     addRegexToken(token, matchUnsigned);
 }
@@ -64,6 +64,9 @@ function parseMs(input, array) {
 for (token = 'S'; token.length <= 9; token += 'S') {
     addParseToken(token, parseMs);
 }
-// MOMENTS
 
-export var getSetMillisecond = makeGetSet('Milliseconds', false);
+getSetMillisecond = makeGetSet('Milliseconds', false);
+
+export {
+    getSetMillisecond
+}
index b645373bd9a83bf5726bdd50ffa13e46fa03abb2..b7277660bf35bb787858c7df6841fb9f81ebe12d 100644 (file)
@@ -74,8 +74,17 @@ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
 
 // LOCALES
 
-var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
-export var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
+var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+    defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+    MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
+    defaultMonthsShortRegex = matchWord,
+    defaultMonthsRegex = matchWord;
+
+export {
+    defaultLocaleMonths,
+    defaultLocaleMonthsShort
+}
+
 export function localeMonths (m, format) {
     if (!m) {
         return isArray(this._months) ? this._months :
@@ -85,7 +94,6 @@ export function localeMonths (m, format) {
         this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
 }
 
-export var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
 export function localeMonthsShort (m, format) {
     if (!m) {
         return isArray(this._monthsShort) ? this._monthsShort :
@@ -215,7 +223,6 @@ export function getDaysInMonth () {
     return daysInMonth(this.year(), this.month());
 }
 
-var defaultMonthsShortRegex = matchWord;
 export function monthsShortRegex (isStrict) {
     if (this._monthsParseExact) {
         if (!hasOwnProp(this, '_monthsRegex')) {
@@ -235,7 +242,6 @@ export function monthsShortRegex (isStrict) {
     }
 }
 
-var defaultMonthsRegex = matchWord;
 export function monthsRegex (isStrict) {
     if (this._monthsParseExact) {
         if (!hasOwnProp(this, '_monthsRegex')) {
index f670ccc3e977fe12b1381b1ff295924c871cbcc1..0a409de0b6e95744ab80c60c909796b768cac7b8 100644 (file)
@@ -18,8 +18,8 @@ import { hooks } from '../utils/hooks';
 
 function offset (token, separator) {
     addFormatToken(token, 0, 0, function () {
-        var offset = this.utcOffset();
-        var sign = '+';
+        var offset = this.utcOffset(),
+         sign = '+';
         if (offset < 0) {
             offset = -offset;
             sign = '-';
@@ -48,19 +48,19 @@ addParseToken(['Z', 'ZZ'], function (input, array, config) {
 var chunkOffset = /([\+\-]|\d\d)/gi;
 
 function offsetFromString(matcher, string) {
-    var matches = (string || '').match(matcher);
+    var matches = (string || '').match(matcher), chunk, parts, minutes;
 
     if (matches === null) {
         return null;
     }
 
-    var chunk   = matches[matches.length - 1] || [];
-    var parts   = (chunk + '').match(chunkOffset) || ['-', 0, 0];
-    var minutes = +(parts[1] * 60) + toInt(parts[2]);
+    chunk   = matches[matches.length - 1] || [];
+    parts   = (chunk + '').match(chunkOffset) || ['-', 0, 0];
+    minutes = +(parts[1] * 60) + toInt(parts[2]);
 
     return minutes === 0 ?
-      0 :
-      parts[0] === '+' ? minutes : -minutes;
+        0 :
+        parts[0] === '+' ? minutes : -minutes;
 }
 
 // Return a moment from input, that is local/utc/zone equivalent to model.
@@ -206,13 +206,13 @@ export function isDaylightSavingTimeShifted () {
         return this._isDSTShifted;
     }
 
-    var c = {};
+    var c = {}, other;
 
     copyConfig(c, this);
     c = prepareConfig(c);
 
     if (c._a) {
-        var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
+        other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
         this._isDSTShifted = this.isValid() &&
             compareArrays(c._a, other.toArray()) > 0;
     } else {
index af227d3618878b3bbf45bb3fe1c4b78db8262d6f..37cfb6c455dbddf256d4263f17641d67990831f0 100644 (file)
@@ -7,8 +7,8 @@ export function addUnitPriority(unit, priority) {
 }
 
 export function getPrioritizedUnits(unitsObj) {
-    var units = [];
-    for (var u in unitsObj) {
+    var units = [], u;
+    for (u in unitsObj) {
         if (hasOwnProp(unitsObj, u)) {
             units.push({unit: u, priority: priorities[u]});
         }
index 8fbd127cf3b21d6ca38eae28d4e7462ab5bea8c7..ae9ff8b939d77dde13939c388f4661e0b10e10a1 100644 (file)
@@ -17,13 +17,13 @@ export function deprecate(msg, fn) {
             hooks.deprecationHandler(null, msg);
         }
         if (firstTime) {
-            var args = [];
-            var arg;
-            for (var i = 0; i < arguments.length; i++) {
+            var args = [],
+                arg, i, key;
+            for (i = 0; i < arguments.length; i++) {
                 arg = '';
                 if (typeof arguments[i] === 'object') {
                     arg += '\n[' + i + '] ';
-                    for (var key in arguments[0]) {
+                    for (key in arguments[0]) {
                         if (hasOwnProp(arguments[0], key)) {
                             arg += key + ': ' + arguments[0][key] + ', ';
                         }
index 1e0094f8e63ed438a1d75dc7c6d4f7cce0dae262..b3624834b4f53a4eb4e4215f0421e3eabd35273d 100644 (file)
@@ -3,9 +3,9 @@ import hasOwnProp from './has-own-prop';
 import isObject from './is-object';
 
 export default function isCalendarSpec(input) {
-    var objectTest = isObject(input) && !isObjectEmpty(input);
+    var objectTest = isObject(input) && !isObjectEmpty(input),
 
-    var propertyTest = false,
+        propertyTest = false,
         properties = [
             'sameDay',
             'nextDay',
@@ -13,9 +13,11 @@ export default function isCalendarSpec(input) {
             'nextWeek',
             'lastWeek',
             'sameElse'
-        ];
+        ],
+        property;
 
-    for (var property of properties) {
+
+    for (property of properties) {
         propertyTest = propertyTest || hasOwnProp(input, property);
     }
 
index ce5e42aa88aa14961580298c9e40ce9e2f79ff3a..b98e4ee5d1548673a16ede2889ddff5dce3167b1 100644 (file)
@@ -20,9 +20,9 @@ export function isMomentInput(input) {
 }
 
 export function isMomentInputObject(input) {
-    var objectTest = isObject(input) && !isObjectEmpty(input);
+    var objectTest = isObject(input) && !isObjectEmpty(input),
 
-    var propertyTest = false,
+     propertyTest = false,
         properties = [
             'years',
             'year',
@@ -48,9 +48,10 @@ export function isMomentInputObject(input) {
             'milliseconds',
             'millisecond',
             'ms'
-        ];
+        ],
+        property;
 
-    for (var property of properties) {
+    for (property of properties) {
         propertyTest = propertyTest || hasOwnProp(input, property);
     }
 
index 695c3d248601a090b255fd63485213aecccc9243..b67ef1dec376601b5f9dcbb397fb40b458d3ec65 100644 (file)
@@ -1,10 +1,12 @@
+import hasOwnProp from './has-own-prop';
+
 export default function isObjectEmpty(obj) {
     if (Object.getOwnPropertyNames) {
         return (Object.getOwnPropertyNames(obj).length === 0);
     } else {
         var k;
         for (k in obj) {
-            if (obj.hasOwnProperty(k)) {
+            if (hasOwnProp(obj, k)) {
                 return false;
             }
         }
index 1bd318675f0665b929c1b05d7ba2099a5f1f41bf..7c0dd392b8226a46ecddfc6ee3893c997b52446e 100644 (file)
@@ -3,10 +3,11 @@ if (Array.prototype.some) {
     some = Array.prototype.some;
 } else {
     some = function (fun) {
-        var t = Object(this);
-        var len = t.length >>> 0;
+        var t = Object(this),
+            len = t.length >>> 0,
+            i;
 
-        for (var i = 0; i < len; i++) {
+        for (i = 0; i < len; i++) {
             if (i in t && fun.call(this, t[i], i, t)) {
                 return true;
             }
index 143a7095f05b8ff68bbc71dee7aabfe92a32c402..b512d76a7588f92f8105817659085ad15102c3c5 100644 (file)
@@ -5,12 +5,12 @@
 import moment from '../moment';
 
 var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
-    monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_');
+    monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'),
 
-var monthsParse = [/^led/i, /^úno/i, /^bře/i, /^dub/i, /^kvě/i, /^(čvn|červen$|června)/i, /^(čvc|červenec|července)/i, /^srp/i, /^zář/i, /^říj/i, /^lis/i, /^pro/i];
+ monthsParse = [/^led/i, /^úno/i, /^bře/i, /^dub/i, /^kvě/i, /^(čvn|červen$|června)/i, /^(čvc|červenec|července)/i, /^srp/i, /^zář/i, /^říj/i, /^lis/i, /^pro/i],
 // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched.
 // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'.
-var monthsRegex = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;
+ monthsRegex = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;
 
 function plural(n) {
     return (n > 1) && (n < 5) && (~~(n / 10) !== 1);
@@ -26,7 +26,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'sekundami';
             }
-            break;
         case 'm':  // a minute / in a minute / a minute ago
             return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
         case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
@@ -35,7 +34,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'minutami';
             }
-            break;
         case 'h':  // an hour / in an hour / an hour ago
             return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
         case 'hh': // 9 hours / in 9 hours / 9 hours ago
@@ -44,7 +42,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'hodinami';
             }
-            break;
         case 'd':  // a day / in a day / a day ago
             return (withoutSuffix || isFuture) ? 'den' : 'dnem';
         case 'dd': // 9 days / in 9 days / 9 days ago
@@ -53,7 +50,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'dny';
             }
-            break;
         case 'M':  // a month / in a month / a month ago
             return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
         case 'MM': // 9 months / in 9 months / 9 months ago
@@ -62,7 +58,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'měsíci';
             }
-            break;
         case 'y':  // a year / in a year / a year ago
             return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
         case 'yy': // 9 years / in 9 years / 9 years ago
@@ -71,7 +66,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'lety';
             }
-            break;
     }
 }
 
index c8397850907eb31796f23ee2c62957a2772cc977..3774a12d055836b2e4090c4f6a7439f102c661eb 100644 (file)
@@ -4,10 +4,10 @@
 import moment from '../moment';
 
 var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
-    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
+    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
 
-var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i];
-var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
+ monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i],
+ monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
 
 export default moment.defineLocale('es-do', {
     months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
index 498ae673eb76975d01de1063c5c5bc2d98a930cc..f449e0f4ec9573b114a6cd12fdebda818b815db3 100644 (file)
@@ -6,10 +6,10 @@
 import moment from '../moment';
 
 var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
-    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
+    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
 
-var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i];
-var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
+ monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i],
+ monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
 
 export default moment.defineLocale('es-us', {
     months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
index 67362d665cc6258e01c869fe15c7508883733f8e..30ddbfb707c561a6baf630500308d79ac5cf806c 100644 (file)
@@ -5,10 +5,10 @@
 import moment from '../moment';
 
 var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
-    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
+    monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
 
-var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i];
-var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
+ monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i],
+ monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
 
 export default moment.defineLocale('es', {
     months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
index a4071028ba32d75e262e5bdddee5eac9146851b8..e49c6db1d173eaed9ff83948f210280270107364 100644 (file)
@@ -6,11 +6,11 @@ import moment from '../moment';
 
 var months = [
     'Eanáir', 'Feabhra', 'Márta', 'Aibreán', 'Bealtaine', 'Meitheamh', 'Iúil', 'Lúnasa', 'Meán Fómhair', 'Deireadh Fómhair', 'Samhain', 'Nollaig'
-];
-var monthsShort = ['Ean', 'Feabh', 'Márt', 'Aib', 'Beal', 'Meith', 'Iúil', 'Lún', 'M.F.', 'D.F.', 'Samh', 'Noll'];
-var weekdays = ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Sathairn'];
-var weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'];
-var weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa'];
+],
+ monthsShort = ['Ean', 'Feabh', 'Márt', 'Aib', 'Beal', 'Meith', 'Iúil', 'Lún', 'M.F.', 'D.F.', 'Samh', 'Noll'],
+ weekdays = ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Sathairn'],
+ weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'],
+ weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa'];
 
 export default moment.defineLocale('ga', {
     months: months,
index b3653d297814d776823d28cc29341cc253d198c0..9c188e92d5af424fa717649823eada49569d1e1a 100644 (file)
@@ -6,15 +6,15 @@ import moment from '../moment';
 
 var months = [
     'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd'
-];
+],
 
-var monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'];
+ monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'],
 
-var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne'];
+ weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne'],
 
-var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'];
+ weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'],
 
-var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
+ weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
 
 export default moment.defineLocale('gd', {
     months : months,
index 1e075de936c66bb05b2ec306adcd5f23b8bd90e4..e3e1e550545c8f1c1d9c45d79e8eb921c95c7e7b 100644 (file)
@@ -6,8 +6,7 @@ import moment from '../moment';
 
 var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
 function translate(number, withoutSuffix, key, isFuture) {
-    var num = number,
-        suffix;
+    var num = number;
     switch (key) {
         case 's':
             return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce';
index d0bde0938b6e3d2b74f53ee52fdd0cdea35a2dce..1373213f04e77d3d9132acaf63f79bbb2fb8a134 100644 (file)
@@ -6,10 +6,10 @@
 import moment from '../moment';
 
 var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
-    monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
+    monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
 
-var monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i];
-var monthsRegex = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
+ monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i],
+ monthsRegex = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
 
 export default moment.defineLocale('nl-be', {
     months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
index fcd6a404bfeebab4f5730763777162bf54abc91d..74cd06af4cbf43bebda7e79a8d353081370cea99 100644 (file)
@@ -6,10 +6,10 @@
 import moment from '../moment';
 
 var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
-    monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
+    monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
 
-var monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i];
-var monthsRegex = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
+ monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i],
+ monthsRegex = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
 
 export default moment.defineLocale('nl', {
     months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
index 9747ad499acd3cbd7d8b808a8376fd8fbb2c5c4d..0f8c7d85cdc84a210e9449b3f4ffa0f1b3f86a87 100644 (file)
@@ -17,8 +17,8 @@ var months = [
     'آڪٽوبر',
     'نومبر',
     'ڊسمبر'
-];
-var days = [
+],
+ days = [
     'آچر',
     'سومر',
     'اڱارو',
index 3cd3ee15a28674ad49ba323b5c5bb3d753653068..dabf8540bf43ad853d51f5d59dd67f8eaf55f78d 100644 (file)
@@ -21,7 +21,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'sekundami';
             }
-            break;
         case 'm':  // a minute / in a minute / a minute ago
             return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
         case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
@@ -30,7 +29,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'minútami';
             }
-            break;
         case 'h':  // an hour / in an hour / an hour ago
             return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
         case 'hh': // 9 hours / in 9 hours / 9 hours ago
@@ -39,7 +37,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'hodinami';
             }
-            break;
         case 'd':  // a day / in a day / a day ago
             return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
         case 'dd': // 9 days / in 9 days / 9 days ago
@@ -48,7 +45,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'dňami';
             }
-            break;
         case 'M':  // a month / in a month / a month ago
             return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
         case 'MM': // 9 months / in 9 months / 9 months ago
@@ -57,7 +53,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'mesiacmi';
             }
-            break;
         case 'y':  // a year / in a year / a year ago
             return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
         case 'yy': // 9 years / in 9 years / 9 years ago
@@ -66,7 +61,6 @@ function translate(number, withoutSuffix, key, isFuture) {
             } else {
                 return result + 'rokmi';
             }
-            break;
     }
 }
 
index 6b18bed83e1d8d0addb9a743798efefd8afbdb09..63c36be9e1d641768040ab2c1a42345b81b56454 100644 (file)
@@ -33,7 +33,7 @@ function weekdaysCaseReplace(m, format) {
         'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'),
         'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'),
         'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_')
-    };
+    }, nounCase;
 
     if (m === true) {
         return weekdays['nominative'].slice(1, 7).concat(weekdays['nominative'].slice(0, 1));
@@ -42,7 +42,7 @@ function weekdaysCaseReplace(m, format) {
         return weekdays['nominative'];
     }
 
-    var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
+    nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
         'accusative' :
         ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ?
             'genitive' :
index 56f18184318ff492b46143a1954024dc17555b6e..124f1904d3465dbfd977a8f94d3874e32e040777 100644 (file)
@@ -18,8 +18,8 @@ var months = [
     'اکتوبر',
     'نومبر',
     'دسمبر'
-];
-var days = [
+],
+ days = [
     'اتوار',
     'پیر',
     'منگل',
index c17a875e615977e9f0b4a45cc965912349529cd1..a1f334cb4b0f9626380686c97c1251a93c3bd679 100644 (file)
@@ -152,10 +152,10 @@ export function defineCommonLocaleTests(locale, options) {
     });
 
     test('localeData weekdays can localeSort', function (assert) {
-        var weekdays = moment().localeData().weekdays();
-        var weekdaysShort = moment().localeData().weekdaysShort();
-        var weekdaysMin = moment().localeData().weekdaysMin();
-        var shift = moment().localeData()._week.dow;
+        var weekdays = moment().localeData().weekdays(),
+         weekdaysShort = moment().localeData().weekdaysShort(),
+         weekdaysMin = moment().localeData().weekdaysMin(),
+         shift = moment().localeData()._week.dow;
         assert.deepEqual(
             moment().localeData().weekdays(true),
             weekdays.slice(shift, 7).concat(weekdays.slice(0, shift)),
diff --git a/src/test/helpers/has-own-prop.js b/src/test/helpers/has-own-prop.js
new file mode 100644 (file)
index 0000000..4d2403c
--- /dev/null
@@ -0,0 +1,3 @@
+export default function hasOwnProp(a, b) {
+    return Object.prototype.hasOwnProperty.call(a, b);
+}
index bdc7364fe34c989cbc1b11aa8b554fdb64c70bf6..8aaefdd7afd3bb58cfc3455020db492d21f717a7 100644 (file)
@@ -1,3 +1,5 @@
+import hasOwnProp from './has-own-prop';
+
 export default function objectKeys(obj) {
     if (Object.keys) {
         return Object.keys(obj);
@@ -5,7 +7,7 @@ export default function objectKeys(obj) {
         // IE8
         var res = [], i;
         for (i in obj) {
-            if (obj.hasOwnProperty(i)) {
+            if (hasOwnProp(obj, i)) {
                 res.push(i);
             }
         }
index b16d5536ce79bcbbd8c14b15571dcc77e477493a..5ee30f780c25c50463a2b3ee241fe2cae0eaff24 100644 (file)
@@ -221,9 +221,9 @@ test('weeks year starting sunday format', function (assert) {
 
 test('weekdays strict parsing', function (assert) {
     var m = moment('2015-01-01T12', moment.ISO_8601, true),
-        enLocale = moment.localeData('en');
+        enLocale = moment.localeData('en'), i;
 
-    for (var i = 0; i < 7; ++i) {
+    for (i = 0; i < 7; ++i) {
         assert.equal(moment(enLocale.weekdays(m.day(i), ''), 'dddd', true).isValid(), true, 'parse weekday ' + i);
         assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'ddd', true).isValid(), true, 'parse short weekday ' + i);
         assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'dd', true).isValid(), true, 'parse min weekday ' + i);
index 0704ab408b60e65a97ad7c8424c4db45f502c1ed..924dbbe1e33502c930dd1ef2f7ea6710516e6e5f 100644 (file)
@@ -99,7 +99,7 @@ test('format week', function (assert) {
 });
 
 test('from', function (assert) {
-    var start = moment([2007, 1, 28]);
+    var start = moment([2007, 1, 28]), s, ss;
     assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true),  'چند ثانیه', '44 seconds = a few seconds');
     assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true),  'یک دقیقه',       '45 seconds = a minute');
     assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true),  'یک دقیقه',       '89 seconds = a minute');
@@ -128,8 +128,10 @@ test('from', function (assert) {
     assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '۲ سال',       '548 days = 2 years');
     assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true),   'یک سال',      '1 year = a year');
     assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true),   '۵ سال',       '5 years = 5 years');
-    var s = moment.relativeTimeThreshold('s');
-    var ss = moment.relativeTimeThreshold('ss');
+
+    s = moment.relativeTimeThreshold('s');
+    ss = moment.relativeTimeThreshold('ss');
+
     moment.relativeTimeThreshold('s', 60);
     moment.relativeTimeThreshold('ss', 0);
     assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true),  '۴۴ ثانیه', '44 seconds = 44 seconds');
index e4515430e62c8c77aeac92082945912b11d4188b..6bb4cc940d543b1930f755c43a10364401a945ac 100644 (file)
@@ -23,8 +23,10 @@ test('parse', function (assert) {
         assert.equal(moment(monthName, monthFormat).month(), monthNum, monthName + ' should be month ' + (monthNum + 1));
     }
 
-    for (var i = 0; i < 12; i++) {
-        var testMonth = months[i].split(',');
+    var i, testMonth;
+    for (i = 0; i < 12; i++) {
+        testMonth = months[i].split(',');
+
         equalTest(testMonth[0], 'MMM', i);
         equalTest(testMonth[1], 'MMM', i);
         equalTest(testMonth[0], 'MMMM', i);
@@ -104,15 +106,16 @@ test('format ordinal', function (assert) {
 });
 
 test('format month', function (assert) {
-    var expected = months;
-    for (var i = 0; i < expected.length; i++) {
+    var expected = months, i;
+    for (i = 0; i < expected.length; i++) {
         assert.equal(moment([2011, i, 1]).format('MMMM,MMM'), expected[i], expected[i]);
     }
 });
 
 test('format week', function (assert) {
-    var expected = ['Dé Domhnaigh Domh Do', 'Dé Luain Luan Lu', 'Dé Máirt Máirt Má', 'Dé Céadaoin Céad Cé', 'Déardaoin Déar Dé', 'Dé hAoine Aoine A', 'Dé Sathairn Sath Sa'];
-    for (var i = 0; i < expected.length; i++) {
+    var expected = ['Dé Domhnaigh Domh Do', 'Dé Luain Luan Lu', 'Dé Máirt Máirt Má', 'Dé Céadaoin Céad Cé', 'Déardaoin Déar Dé', 'Dé hAoine Aoine A', 'Dé Sathairn Sath Sa'],
+        i;
+    for (i = 0; i < expected.length; i++) {
         assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
     }
 });
index b9c4789cdd32ef6a193cec0684d152c34b8c30ef..ae5899b085c29e09144cb84a347a70aea4e3d065 100644 (file)
@@ -23,8 +23,10 @@ test('parse', function (assert) {
         assert.equal(moment(monthName, monthFormat).month(), monthNum, monthName + ' should be month ' + (monthNum + 1));
     }
 
-    for (var i = 0; i < 12; i++) {
-        var testMonth = months[i].split(',');
+    var i, testMonth;
+    for (i = 0; i < 12; i++) {
+        testMonth = months[i].split(',');
+
         equalTest(testMonth[0], 'MMM', i);
         equalTest(testMonth[1], 'MMM', i);
         equalTest(testMonth[0], 'MMMM', i);
@@ -104,15 +106,16 @@ test('format ordinal', function (assert) {
 });
 
 test('format month', function (assert) {
-    var expected = months;
-    for (var i = 0; i < expected.length; i++) {
+    var expected = months, i;
+    for (i = 0; i < expected.length; i++) {
         assert.equal(moment([2011, i, 1]).format('MMMM,MMM'), expected[i], expected[i]);
     }
 });
 
 test('format week', function (assert) {
-    var expected = ['Didòmhnaich Did Dò', 'Diluain Dil Lu', 'Dimàirt Dim Mà', 'Diciadain Dic Ci', 'Diardaoin Dia Ar', 'Dihaoine Dih Ha', 'Disathairne Dis Sa'];
-    for (var i = 0; i < expected.length; i++) {
+    var expected = ['Didòmhnaich Did Dò', 'Diluain Dil Lu', 'Dimàirt Dim Mà', 'Diciadain Dic Ci', 'Diardaoin Dia Ar', 'Dihaoine Dih Ha', 'Disathairne Dis Sa'],
+        i;
+    for (i = 0; i < expected.length; i++) {
         assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
     }
 });
index 1316724032d8091c24f7b5704f69d895d7032663..885b7ed1f293cfe5bee5b165ff86b045aa0c1001 100644 (file)
@@ -126,8 +126,8 @@ test('calendar day', function (assert) {
 });
 
 test('calendar next week', function (assert) {
-    var i, m;
-    var dow = moment().day();
+    var i, m,
+     dow = moment().day();
     for (i = 2; i < 7; i++) {
         m = moment().add({d: i});
         if (dow + i < 7) {
@@ -147,8 +147,8 @@ test('calendar next week', function (assert) {
 });
 
 test('calendar last week', function (assert) {
-    var i, m;
-    var dow = moment().day();
+    var i, m,
+     dow = moment().day();
     for (i = 2; i < 7; i++) {
         m = moment().subtract({d: i});
         if (dow < i) {
index 4f3b3a9caecb944de3e8807447dce940686aeea8..5c0f9eba2e6a0630259a8cbfe9ef6222298839ba 100644 (file)
@@ -16,8 +16,8 @@ var months = [
     'آڪٽوبر',
     'نومبر',
     'ڊسمبر'
-];
-var days = [
+],
+ days = [
     'آچر',
     'سومر',
     'اڱارو',
index a27e73a0f393dd136155322b2ce53801523c8676..3e701c5b25be6410dbfbe6275d3eac6a041ab118 100644 (file)
@@ -16,8 +16,8 @@ var months = [
     'اکتوبر',
     'نومبر',
     'دسمبر'
-];
-var days = [
+],
+ days = [
     'اتوار',
     'پیر',
     'منگل',
index 8a64570bf1b5f7ee1f692934701ecdbe99fa380e..efda701cb2955dd539b57f4d3e4236164cf73aed 100644 (file)
@@ -15,13 +15,13 @@ test('passing a function', function (assert) {
 });
 
 test('extending calendar options', function (assert) {
-    var calendarFormat = moment.calendarFormat;
+    var calendarFormat = moment.calendarFormat, a, b;
 
     moment.calendarFormat = function (myMoment, now) {
-        var diff = myMoment.diff(now, 'days', true);
-        var nextMonth = now.clone().add(1, 'month');
+        var diff = myMoment.diff(now, 'days', true),
+         nextMonth = now.clone().add(1, 'month'),
 
-        var retVal =  diff < -6 ? 'sameElse' :
+         retVal =  diff < -6 ? 'sameElse' :
             diff < -1 ? 'lastWeek' :
             diff < 0 ? 'lastDay' :
             diff < 1 ? 'sameDay' :
@@ -44,8 +44,10 @@ test('extending calendar options', function (assert) {
                 sameElse : 'L'
             }
     });
-    var a = moment('2016-01-01').add(28, 'days');
-    var b = moment('2016-01-01').add(1, 'month');
+
+    a = moment('2016-01-01').add(28, 'days');
+    b = moment('2016-01-01').add(1, 'month');
+
     try {
         assert.equal(a.calendar('2016-01-01'), 'This month on the 29th', 'Ad hoc calendar format for this month');
         assert.equal(b.calendar('2016-01-01'), 'Next month on the 1st', 'Ad hoc calendar format for next month');
@@ -57,8 +59,8 @@ test('extending calendar options', function (assert) {
 });
 
 test('calendar overload time - passing one parameter - a Moment', function (assert) {
-    var a = moment().hours(13).minutes(23).seconds(45);
-    var b = moment().add(1, 'd');
+    var a = moment().hours(13).minutes(23).seconds(45),
+     b = moment().add(1, 'd');
     assert.equal(
         a.calendar(b),
         'Yesterday at 1:23 PM',
@@ -67,8 +69,8 @@ test('calendar overload time - passing one parameter - a Moment', function (asse
 });
 
 test('calendar overload time - passing one parameter - a Date', function (assert) {
-    var a = moment().hours(13).minutes(23).seconds(45).subtract(1, 'd');
-    var d = new Date();
+    var a = moment().hours(13).minutes(23).seconds(45).subtract(1, 'd'),
+     d = new Date();
     assert.equal(
         a.calendar(d),
         'Yesterday at 1:23 PM',
@@ -113,17 +115,17 @@ test('calendar overload time - passing one parameter - an array of strings', fun
 });
 
 test('calendar overload time - passing one parameter - a moment input object', function (assert) {
-    var a = moment();
+    var a = moment(),
 
-    var todayTime = new Date(),
+     todayTime = new Date(),
         month = todayTime.getMonth() + 1,
         day = todayTime.getDate(),
-        year = todayTime.getFullYear();
+        year = todayTime.getFullYear(), expectedString;
 
     month = month < 10 ? '0' + month.toString() : month;
     day = day < 10 ? '0' + day.toString() : day;
 
-    var expectedString = month + '/' + day + '/' + year;
+    expectedString = month + '/' + day + '/' + year;
 
     assert.equal(
         a.calendar({
index 31fe5d5318ce52ec3c75e568bbefd065ebe95eb5..e2738330dccd4dedd5dc9eb6695b20c5b1d9d342 100644 (file)
@@ -1,5 +1,6 @@
 import { module, test } from '../qunit';
 import eachOwnProp from '../helpers/each-own-prop';
+import hasOwnProp from '../helpers/has-own-prop';
 import moment from '../../moment';
 
 module('create');
@@ -108,7 +109,7 @@ test('moment', function (assert) {
 });
 
 test('cloning moment should only copy own properties', function (assert) {
-    assert.ok(!moment().clone().hasOwnProperty('month'), 'Should not clone prototype methods');
+    assert.ok(!hasOwnProp(moment().clone(), 'month'), 'Should not clone prototype methods');
 });
 
 test('cloning moment works with weird clones', function (assert) {
@@ -1045,13 +1046,13 @@ function getVerifier(test) {
 }
 
 test('parsing week and weekday information', function (assert) {
-    var ver = getVerifier(assert);
-    var currentWeekOfYear = moment().weeks();
-    var expectedDate2012 = moment([2012, 0, 1])
+    var ver = getVerifier(assert),
+     currentWeekOfYear = moment().weeks(),
+     expectedDate2012 = moment([2012, 0, 1])
       .day(0)
       .add((currentWeekOfYear - 1), 'weeks')
-      .format('YYYY MM DD');
-    var expectedDate1999 = moment([1999, 0, 1])
+      .format('YYYY MM DD'),
+     expectedDate1999 = moment([1999, 0, 1])
       .day(0)
       .add((currentWeekOfYear - 1), 'weeks')
       .format('YYYY MM DD');
@@ -1228,11 +1229,11 @@ test('Y token', function (assert) {
 });
 
 test('parsing flags retain parsed date parts', function (assert) {
-    var a = moment('10 p', 'hh:mm a');
+    var a = moment('10 p', 'hh:mm a'), b;
     assert.equal(a.parsingFlags().parsedDateParts[3], 10, 'parsed 10 as the hour');
     assert.equal(a.parsingFlags().parsedDateParts[0], undefined, 'year was not parsed');
     assert.equal(a.parsingFlags().meridiem, 'p', 'meridiem flag was added');
-    var b = moment('10:30', ['MMDDYY', 'HH:mm']);
+    b = moment('10:30', ['MMDDYY', 'HH:mm']);
     assert.equal(b.parsingFlags().parsedDateParts[3], 10, 'multiple format parshing matched hour');
     assert.equal(b.parsingFlags().parsedDateParts[0], undefined, 'array is properly copied, no residual data from first token parse');
 });
@@ -1250,9 +1251,10 @@ test('invalid dates return invalid for methods that access the _d prop', functio
 });
 
 test('k, kk', function (assert) {
-    for (var i = -1; i <= 24; i++) {
-        var kVal = i + ':15:59';
-        var kkVal = (i < 10 ? '0' : '') + i + ':15:59';
+    var i, kVal, kkVal;
+    for (i = -1; i <= 24; i++) {
+        kVal = i + ':15:59';
+        kkVal = (i < 10 ? '0' : '') + i + ':15:59';
         if (i !== 24) {
             assert.ok(moment(kVal, 'k:mm:ss').isSame(moment(kVal, 'H:mm:ss')), kVal + ' k parsing');
             assert.ok(moment(kkVal, 'kk:mm:ss').isSame(moment(kkVal, 'HH:mm:ss')), kkVal + ' kk parsing');
index 15391462ece918f8a70134e00e95ee6d385b1590..5afaf3898cbcfec4345b1f14b80cc0242bbf4b39 100644 (file)
@@ -4,8 +4,8 @@ import moment from '../../moment';
 module('creation data');
 
 test('valid date', function (assert) {
-    var dat = moment('1992-10-22');
-    var orig = dat.creationData();
+    var dat = moment('1992-10-22'),
+     orig = dat.creationData();
 
     assert.equal(dat.isValid(), true, '1992-10-22 is valid');
     assert.equal(orig.input, '1992-10-22', 'original input is not correct.');
@@ -15,15 +15,15 @@ test('valid date', function (assert) {
 });
 
 test('valid date at fr locale', function (assert) {
-    var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr');
-    var orig = dat.creationData();
+    var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr'),
+     orig = dat.creationData();
 
     assert.equal(orig.locale._abbr, 'fr', 'locale is fr');
 });
 
 test('valid date with formats', function (assert) {
-    var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']);
-    var orig = dat.creationData();
+    var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']),
+     orig = dat.creationData();
 
     assert.equal(orig.format, 'DD-MM-YYYY', 'DD-MM-YYYY format is defined.');
 });
index a17ac8c538c11487309246106ad49c44ce69b342..eba6c9e5934b41fe02bddaa8954e52ae8c788a0d 100644 (file)
@@ -1,14 +1,13 @@
 import { module, test } from '../qunit';
 import { deprecate } from '../../lib/utils/deprecate';
-import moment from '../../moment';
 
 module('deprecate');
 
 test('deprecate', function (assert) {
     // NOTE: hooks inside deprecate.js and moment are different, so this is can
     // not be test.expectedDeprecations(...)
-    var fn = function () {};
-    var deprecatedFn = deprecate('testing deprecation', fn);
+    var fn = function () {},
+     deprecatedFn = deprecate('testing deprecation', fn);
     deprecatedFn();
 
     assert.expect(0);
index 8ebc60891462fcca2806afa06d87928cc3efddda..8244e55a69cae9a68e8676b82d45dd731bd16d79 100644 (file)
@@ -103,7 +103,7 @@ test('diff month', function (assert) {
 });
 
 test('diff across DST', function (assert) {
-    var dst = dstForYear(2012), a, b, daysInMonth;
+    var dst = dstForYear(2012), a, b;
     if (!dst) {
         assert.equal(42, 42, 'at least one assertion');
         return;
@@ -111,7 +111,6 @@ test('diff across DST', function (assert) {
 
     a = dst.moment;
     b = a.clone().utc().add(12, 'hours').local();
-    daysInMonth = (a.daysInMonth() + b.daysInMonth()) / 2;
     assert.equal(b.diff(a, 'milliseconds', true), 12 * 60 * 60 * 1000,
             'ms diff across DST');
     assert.equal(b.diff(a, 'seconds', true), 12 * 60 * 60,
@@ -135,7 +134,6 @@ test('diff across DST', function (assert) {
 
     a = dst.moment;
     b = a.clone().utc().add(12 + dst.diff, 'hours').local();
-    daysInMonth = (a.daysInMonth() + b.daysInMonth()) / 2;
 
     assert.equal(b.diff(a, 'milliseconds', true),
             (12 + dst.diff) * 60 * 60 * 1000,
index 53fe125da7c62585e78f9a5622257047b926308f..829dbf874f86d0df1740a97a4ad36c6ff23a26e1 100644 (file)
@@ -173,8 +173,8 @@ test('instantiation from another duration', function (assert) {
 });
 
 test('explicit cloning', function (assert) {
-    var durationA = moment.duration(5, 'milliseconds');
-    var durationB = durationA.clone();
+    var durationA = moment.duration(5, 'milliseconds'),
+     durationB = durationA.clone();
     durationA.add(5, 'milliseconds');
     assert.notEqual(durationA.milliseconds(), durationB.milliseconds(), 'Calling duration.clone() on a duration will create a clone');
 });
@@ -737,8 +737,8 @@ test('add', function (assert) {
 });
 
 test('add to moment', function (assert) {
-    var d = moment.duration({months: 1, seconds: -1});
-    var m = moment('2017-03-01').add(d);
+    var d = moment.duration({months: 1, seconds: -1}),
+     m = moment('2017-03-01').add(d);
     assert.equal(m.month(), 2, 'Adds months before time');
     assert.equal(m.date(), 31, 'Adds time after months');
 });
index f8488e05f17eab294b11242ecf510f71e1c2ab96..acb862b6fe815fe6fe6911913355b8abf975f01c 100644 (file)
@@ -64,8 +64,7 @@ test('invalid duration operations', function (assert) {
             moment.duration.invalid()
         ],
         i,
-        invalid,
-        valid = moment.duration();
+        invalid;
 
     for (i = 0; i < invalids.length; ++i) {
         invalid = invalids[i];
index cb5b8c5a7aef894ffcb89bd064439a4310b30b77..615f7b86531a4b647cebc1c7e8e8fe33f2d7cbdd 100644 (file)
@@ -1,5 +1,4 @@
 import { module, test } from '../qunit';
-import each from '../helpers/each';
 import eachOwnProp from '../helpers/each-own-prop';
 import moment from '../../moment';
 
index 23dd062520d3532e845092589b2b1ca32d97e1f9..d30716e00df8cc6a47ff3a027055ea5f428013dc 100644 (file)
@@ -216,7 +216,7 @@ test('chaining setters', function (assert) {
 });
 
 test('setter with multiple unit values', function (assert) {
-    var a = moment();
+    var a = moment(), c;
     a.set({
         year: 2011,
         month: 9,
@@ -235,7 +235,7 @@ test('setter with multiple unit values', function (assert) {
     assert.equal(a.seconds(), 8, 'second');
     assert.equal(a.milliseconds(), 9, 'milliseconds');
 
-    var c = moment([2016,0,1]);
+    c = moment([2016,0,1]);
     assert.equal(c.set({weekYear: 2016}).weekYear(), 2016, 'week year correctly sets with object syntax');
     assert.equal(c.set({quarter: 3}).quarter(), 3, 'quarter sets correctly with object syntax');
 });
@@ -270,32 +270,32 @@ test('day setter', function (assert) {
 });
 
 test('year setter', function (assert) {
-    var a = moment([2015, 3, 15]);
+    var a = moment([2015, 3, 15]), b, c, d, e;
     assert.equal(moment(a).year(2016).format('YYYY-MM-DD'), '2016-04-15', 'set from 2015 to 2016');
     assert.equal(moment(a).year(2011).format('YYYY-MM-DD'), '2011-04-15', 'set from 2015 to 2011');
 
-    var b = moment([2012, 1, 29]);
+    b = moment([2012, 1, 29]);
     assert.equal(moment(b).year(2017).format('YYYY-MM-DD'), '2017-02-28', 'set from last day of february on a leap year to a non leap year');
     assert.equal(moment(b).year(2004).format('YYYY-MM-DD'), '2004-02-29', 'set from last day of february on a leap year to a leap year');
 
-    var c = moment([2012, 9, 4]);
+    c = moment([2012, 9, 4]);
     assert.equal(moment(c).year(2017).format('YYYY-MM-DD'), '2017-10-04', 'set from a random day on a leap year to a non leap year');
     assert.equal(moment(c).year(2004).format('YYYY-MM-DD'), '2004-10-04', 'set from a random day on a leap year to a leap year');
 
-    var d = moment([2020, 1, 29]);
+    d = moment([2020, 1, 29]);
     assert.equal(moment(d).year('2020').format('YYYY-MM-DD'), '2020-02-29', 'set from last day of february in 2020 to the same year, provided as string');
 
-    var e = moment([2012, 1, 29]);
+    e = moment([2012, 1, 29]);
     assert.equal(moment(e).year('2020').format('YYYY-MM-DD'), '2020-02-29', 'set from last day of february on a leap year to 2020, provided as string');
 });
 
 test('object set ordering', function (assert) {
-    var a = moment([2016,3,30]);
+    var a = moment([2016,3,30]), b, c;
     assert.equal(a.set({date:31, month:4}).date(), 31, 'setter order automatically arranged by size');
-    var b = moment([2015,1,28]);
+    b = moment([2015,1,28]);
     assert.equal(b.set({date:29, year: 2016}).format('YYYY-MM-DD'), '2016-02-29', 'year is prioritized over date');
     //check a nonexistent time in US isn't set
-    var c = moment([2016,2,13]);
+    c = moment([2016,2,13]);
     c.set({
         hour:2,
         minutes:30,
index bf9b66af3f6df6cd4a717b5b8c66fbce3c66f4b3..17ca30d3d1feadb717a5db2bcc8d7fa51dbf2fde 100644 (file)
@@ -4,8 +4,6 @@ import moment from '../../moment';
 module('instanceof');
 
 test('instanceof', function (assert) {
-    var mm = moment([2010, 0, 1]);
-
     var extend = function (a, b) {
         var i;
         for (i in b) {
index 460234483089f81f92f4ed8f4ed7aa70557502ff..217f3285565671a7b7f4d9ee04b9bf99145daaed 100644 (file)
@@ -1,4 +1,4 @@
-import { module, test } from '../qunit';
+import { test } from '../qunit';
 import isArray from '../../lib/utils/is-array.js';
 
 
index 656112cc2d918927737a6eb7d0352e74353af487..40ae8f76b53deaeb3560b4ee28ea537d4a21bc87 100644 (file)
@@ -73,7 +73,7 @@ test('is between without units', function (assert) {
 });
 
 test('is between without units inclusivity', function (assert) {
-    var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
+    var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10));
     assert.equal(m.isBetween(
         moment(new Date(2011, 3, 2, 3, 4, 5, 10)),
         moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, start is equal to moment');
@@ -140,7 +140,7 @@ test('is between without units inclusivity', function (assert) {
 });
 
 test('is between milliseconds inclusivity', function (assert) {
-    var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m);
+    var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10));
     assert.equal(m.isBetween(
         moment(new Date(2010, 3, 2, 3, 4, 5, 10)),
         moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'options, no inclusive');
index c6974c09c00948b8fb84617400d9af6590307aae..b2a956ebc67bcef42d7edb2e4787b6fb53346305 100644 (file)
@@ -1,4 +1,4 @@
-import { module, test } from '../qunit';
+import { test } from '../qunit';
 import isNumber from '../../lib/utils/is-number.js';
 
 
index 5288b4f1a0814e307bdbc4e82524d07742f091a0..1e97c4f7d66078eb4668b995bae92b13ded8cf4c 100644 (file)
@@ -130,9 +130,9 @@ test('valid string iso 8601 - not strict', function (assert) {
         '20100130T235959,999-0700',
         '20100130T000000,000+0700',
         '20100130 000000,000Z'
-    ];
+    ], i;
 
-    for (var i = 0; i < tests.length; i++) {
+    for (i = 0; i < tests.length; i++) {
         assert.equal(moment(tests[i]).isValid(), true, tests[i] + ' should be valid in normal');
         assert.equal(moment.utc(tests[i]).isValid(), true, tests[i] + ' should be valid in normal');
     }
index 86f5c1c4cd7a8db386e5bb19ceef139f7904dd21..71e03b2f54d1153f2df9261c079abdda4ce4e648 100644 (file)
@@ -105,15 +105,8 @@ test('with locale data', function (assert) {
         weekdays = 'one_two_three_four_five_six_seven'.split('_'),
         weekdaysShort = 'on_tw_th_fo_fi_si_se'.split('_'),
         weekdaysMin = '1_2_3_4_5_6_7'.split('_'),
-        weekdaysLocale = 'four_five_six_seven_one_two_three'.split('_'),
-        weekdaysShortLocale = 'fo_fi_si_se_on_tw_th'.split('_'),
-        weekdaysMinLocale = '4_5_6_7_1_2_3'.split('_'),
-        week = {
-            dow : 3,
-            doy : 6
-        };
 
-    var customLocale = moment.localeData('numerologists');
+     customLocale = moment.localeData('numerologists');
 
     assert.deepEqual(customLocale.months(), months);
     assert.deepEqual(customLocale.monthsShort(), monthsShort);
index 5b9a8687273173c72d292be99a4285e160e4bdd8..a577fb4fb04e7fa7069a8093ec729e53c4299cc8 100644 (file)
@@ -215,8 +215,7 @@ test('instance locale persists with cloning', function (assert) {
     moment.locale('en');
 
     var a = moment([2012, 5, 6]).locale('es'),
-        b = a.clone(),
-        c = moment(a);
+        b = a.clone();
 
     assert.equal(b.format('MMMM'), 'junio', 'using moment.fn.clone()');
     assert.equal(b.format('MMMM'), 'junio', 'using moment()');
index 56d96346944c58807b55f1eaed82ee76603518e6..ae2515e3210260c94883015b4a5414d28c3489df 100644 (file)
@@ -11,14 +11,12 @@ test('normalize units', function (assert) {
         fullKeyCaps,
         fullKeyPlural,
         fullKeyCapsPlural,
-        fullKeyLower,
         alias,
         index;
 
     for (index = 0; index < length; index += 1) {
         fullKey = fullKeys[index];
         fullKeyCaps = fullKey.toUpperCase();
-        fullKeyLower = fullKey.toLowerCase();
         fullKeyPlural = fullKey + 's';
         fullKeyCapsPlural = fullKeyCaps + 's';
         alias = aliases[index];
index 9efc28c693d4c60ca8aa3765366921fc3b81dcc5..09614a769b06974cce24974981dd13d6636656c4 100644 (file)
@@ -13,8 +13,6 @@ test('now', function (assert) {
 });
 
 test('now - Date mocked', function (assert) {
-    // We need to test mocking the global Date object, so disable 'Read Only' jshint check
-    /* jshint -W020 */
     var RealDate = Date,
         customTimeMs = moment('2015-01-01T01:30:00.000Z').valueOf();
 
@@ -28,11 +26,13 @@ test('now - Date mocked', function (assert) {
 
     MockDate.prototype = RealDate.prototype;
 
+    // eslint-disable-next-line
     Date = MockDate;
 
     try {
         assert.equal(moment().valueOf(), customTimeMs, 'moment now() time should use the global Date object');
     } finally {
+        // eslint-disable-next-line
         Date = RealDate;
     }
 });
index 8c14ab55d783cfd07964f7adf93d1f6796dac7bb..b25e22cbf6ab629c6615481049c8e5c73d54b0b9 100644 (file)
@@ -181,7 +181,7 @@ test('custom thresholds', function (assert) {
 });
 
 test('custom rounding', function (assert) {
-    var roundingDefault = moment.relativeTimeRounding();
+    var roundingDefault = moment.relativeTimeRounding(), a, retainValue;
 
     // Round relative time evaluation down
     moment.relativeTimeRounding(Math.floor);
@@ -192,7 +192,7 @@ test('custom rounding', function (assert) {
     moment.relativeTimeThreshold('d', 27);
     moment.relativeTimeThreshold('M', 12);
 
-    var a = moment.utc();
+    a = moment.utc();
     a.subtract({minutes: 59, seconds: 59});
     assert.equal(a.toNow(), 'in 59 minutes', 'Round down towards the nearest minute');
 
@@ -217,7 +217,7 @@ test('custom rounding', function (assert) {
     assert.equal(a.toNow(), 'in a year', 'Round down towards the nearest year');
 
     // Do not round relative time evaluation
-    var retainValue = function (value) {
+    retainValue = function (value) {
         return value.toFixed(3);
     };
     moment.relativeTimeRounding(retainValue);
index d540c9ff5a7b953bc7c3bf2f64a6073d74a07e49..f129cb8f9c522e9c3478c4ff8d7ecf36f41b6a35 100644 (file)
@@ -22,8 +22,8 @@ test('toArray', function (assert) {
 });
 
 test('toDate returns a copy of the internal date', function (assert) {
-    var m = moment();
-    var d = m.toDate();
+    var m = moment(),
+     d = m.toDate();
     m.year(0);
     assert.notEqual(d, m.toDate());
 });
@@ -40,8 +40,8 @@ test('toJSON', function (assert) {
 
 test('toJSON works when moment is frozen', function (assert) {
     if (Date.prototype.toISOString) {
-        var expected = new Date().toISOString();
-        var m = moment(expected);
+        var expected = new Date().toISOString(),
+         m = moment(expected);
         if (Object.freeze != null) {
             Object.freeze(m);
         }
index f2647024b76335d059a4bf650f0fcb84878c0a0e..1d755a9ccb7d9f158be6278bce60f18c0e26f38c 100644 (file)
@@ -461,10 +461,10 @@ test('timezone format', function (assert) {
 
 test('parse zone without a timezone', function (assert) {
     test.expectedDeprecations();
-    var m1 = moment.parseZone('2016-02-01T00:00:00');
-    var m2 = moment.parseZone('2016-02-01T00:00:00Z');
-    var m3 = moment.parseZone('2016-02-01T00:00:00+00:00'); //Someone might argue this is not necessary, you could even argue that is wrong being here.
-    var m4 = moment.parseZone('2016-02-01T00:00:00+0000'); //Someone might argue this is not necessary, you could even argue that is wrong being here.
+    var m1 = moment.parseZone('2016-02-01T00:00:00'),
+     m2 = moment.parseZone('2016-02-01T00:00:00Z'),
+     m3 = moment.parseZone('2016-02-01T00:00:00+00:00'), //Someone might argue this is not necessary, you could even argue that is wrong being here.
+     m4 = moment.parseZone('2016-02-01T00:00:00+0000'); //Someone might argue this is not necessary, you could even argue that is wrong being here.
     assert.equal(
         m1.format('M D YYYY HH:mm:ss ZZ'),
         '2 1 2016 00:00:00 +0000',
@@ -490,11 +490,12 @@ test('parse zone without a timezone', function (assert) {
 test('parse zone with a minutes unit abs less than 16 should retain minutes', function (assert) {
     //ensure when minutes are explicitly parsed, they are retained
     //instead of converted to hours, even if less than 16
-    var n = moment.parseZone('2013-01-01T00:00:00-00:15');
+    var n = moment.parseZone('2013-01-01T00:00:00-00:15'), o;
     assert.equal(n.utcOffset(), -15);
     assert.equal(n.zone(), 15);
     assert.equal(n.hour(), 0);
-    var o = moment.parseZone('2013-01-01T00:00:00+00:15');
+
+    o = moment.parseZone('2013-01-01T00:00:00+00:15');
     assert.equal(o.utcOffset(), 15);
     assert.equal(o.zone(), -15);
     assert.equal(o.hour(), 0);
index 9afcffd31549e312dbbc8aaf955ea6449185cc4a..f0aa788a0a800d4d35dd87181188006fc0cac1b0 100644 (file)
@@ -3,8 +3,8 @@
 import moment from '../moment';
 import { setupDeprecationHandler, teardownDeprecationHandler } from './helpers/deprecation-handler';
 
-export var test = QUnit.test;
-export var only = QUnit.only;
+export var test = QUnit.test,
+    only = QUnit.only;
 
 export function module (name, lifecycle) {
     QUnit.module(name, {
index 45026516d30fceea90b13e4e6d3aac9389551fad..02d583453e1c970c5214be278b6e44fc211cd7d2 100644 (file)
@@ -1,16 +1,14 @@
 module.exports = function (grunt) {
     grunt.task.registerTask('qtest', 'run tests locally', function () {
-        var done = this.async();
+        var done = this.async(), testrunner, tests;
 
-        var testrunner = require('node-qunit');
+        testrunner = require('node-qunit');
         testrunner.options.log.assertions = false;
         testrunner.options.log.tests = false;
         testrunner.options.log.summary = false;
         testrunner.options.log.testing = false;
         testrunner.options.maxBlockDuration = 600000;
 
-        var tests;
-
         if (grunt.option('only') != null) {
             tests = grunt.file.expand.apply(null, grunt.option('only').split(',').map(function (file) {
                 if (file === 'moment') {
index 3771de0b5492aa1a68ffdd66d222599e5385b35b..99f64270b84eda09bd2123087a9e32c32598a7ad 100644 (file)
@@ -2,9 +2,10 @@ module.exports = function (grunt) {
     // var esperanto = require('esperanto');
     var rollup = require('rollup').rollup;
     // var babel = require('rollup-plugin-babel');
-    var path = require('path');
-    var Promise = require('es6-promise').Promise;
-    var TMP_DIR = 'build/tmp';
+    var path = require('path'),
+        Promise = require('es6-promise').Promise,
+        TMP_DIR = 'build/tmp',
+        headerCache = {};
 
     function moveComments(code, moveType) {
         var comments = [], rest = [], skipId = -1;
@@ -32,7 +33,6 @@ module.exports = function (grunt) {
         return comments.concat([''], rest).join('\n');
     }
 
-    var headerCache = {};
     function getHeaderByFile(headerFile) {
         if (headerFile === 'none') {
             return '';
@@ -248,9 +248,9 @@ module.exports = function (grunt) {
     grunt.task.registerTask('transpile-custom-raw',
             'build just custom language bundles',
             function (locales) {
-        var done = this.async();
+        var done = this.async(),
 
-        var localeFiles = locales.split(',').map(function (locale) {
+         localeFiles = locales.split(',').map(function (locale) {
             var file = grunt.file.expand({cwd: 'src'}, 'locale/' + locale + '.js');
             if (file.length !== 1) {
                 // we failed to find a locale