Skip to content

Commit d6f5838

Browse files
Updated monentjs (2.29.1 => 2.29.4)
1 parent 67ca9cd commit d6f5838

File tree

2 files changed

+97
-82
lines changed

2 files changed

+97
-82
lines changed

src/jQueryDatatableServerSideNetCore/wwwroot/lib/momentjs/moment.js

Lines changed: 96 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! moment.js
2-
//! version : 2.29.1
2+
//! version : 2.29.4
33
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
44
//! license : MIT
55
//! momentjs.com
@@ -76,8 +76,9 @@
7676

7777
function map(arr, fn) {
7878
var res = [],
79-
i;
80-
for (i = 0; i < arr.length; ++i) {
79+
i,
80+
arrLen = arr.length;
81+
for (i = 0; i < arrLen; ++i) {
8182
res.push(fn(arr[i], i));
8283
}
8384
return res;
@@ -206,7 +207,10 @@
206207
updateInProgress = false;
207208

208209
function copyConfig(to, from) {
209-
var i, prop, val;
210+
var i,
211+
prop,
212+
val,
213+
momentPropertiesLen = momentProperties.length;
210214

211215
if (!isUndefined(from._isAMomentObject)) {
212216
to._isAMomentObject = from._isAMomentObject;
@@ -239,8 +243,8 @@
239243
to._locale = from._locale;
240244
}
241245

242-
if (momentProperties.length > 0) {
243-
for (i = 0; i < momentProperties.length; i++) {
246+
if (momentPropertiesLen > 0) {
247+
for (i = 0; i < momentPropertiesLen; i++) {
244248
prop = momentProperties[i];
245249
val = from[prop];
246250
if (!isUndefined(val)) {
@@ -295,8 +299,9 @@
295299
var args = [],
296300
arg,
297301
i,
298-
key;
299-
for (i = 0; i < arguments.length; i++) {
302+
key,
303+
argLen = arguments.length;
304+
for (i = 0; i < argLen; i++) {
300305
arg = '';
301306
if (typeof arguments[i] === 'object') {
302307
arg += '\n[' + i + '] ';
@@ -446,7 +451,8 @@
446451
);
447452
}
448453

449-
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
454+
var formattingTokens =
455+
/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
450456
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
451457
formatFunctions = {},
452458
formatTokenFunctions = {};
@@ -750,8 +756,9 @@
750756
if (typeof units === 'object') {
751757
units = normalizeObjectUnits(units);
752758
var prioritized = getPrioritizedUnits(units),
753-
i;
754-
for (i = 0; i < prioritized.length; i++) {
759+
i,
760+
prioritizedLen = prioritized.length;
761+
for (i = 0; i < prioritizedLen; i++) {
755762
this[prioritized[i].unit](units[prioritized[i].unit]);
756763
}
757764
} else {
@@ -781,7 +788,8 @@
781788
matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
782789
// any word (or two) characters or numbers including two/three word month in arabic.
783790
// includes scottish gaelic two word and hyphenated months
784-
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,
791+
matchWord =
792+
/[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,
785793
regexes;
786794

787795
regexes = {};
@@ -807,15 +815,12 @@
807815
return regexEscape(
808816
s
809817
.replace('\\', '')
810-
.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
811-
matched,
812-
p1,
813-
p2,
814-
p3,
815-
p4
816-
) {
817-
return p1 || p2 || p3 || p4;
818-
})
818+
.replace(
819+
/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
820+
function (matched, p1, p2, p3, p4) {
821+
return p1 || p2 || p3 || p4;
822+
}
823+
)
819824
);
820825
}
821826

@@ -827,7 +832,8 @@
827832

828833
function addParseToken(token, callback) {
829834
var i,
830-
func = callback;
835+
func = callback,
836+
tokenLen;
831837
if (typeof token === 'string') {
832838
token = [token];
833839
}
@@ -836,7 +842,8 @@
836842
array[callback] = toInt(input);
837843
};
838844
}
839-
for (i = 0; i < token.length; i++) {
845+
tokenLen = token.length;
846+
for (i = 0; i < tokenLen; i++) {
840847
tokens[token[i]] = func;
841848
}
842849
}
@@ -947,12 +954,12 @@
947954

948955
// LOCALES
949956

950-
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
951-
'_'
952-
),
953-
defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
954-
'_'
955-
),
957+
var defaultLocaleMonths =
958+
'January_February_March_April_May_June_July_August_September_October_November_December'.split(
959+
'_'
960+
),
961+
defaultLocaleMonthsShort =
962+
'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
956963
MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
957964
defaultMonthsShortRegex = matchWord,
958965
defaultMonthsRegex = matchWord;
@@ -1394,14 +1401,12 @@
13941401
addRegexToken('W', match1to2);
13951402
addRegexToken('WW', match1to2, match2);
13961403

1397-
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
1398-
input,
1399-
week,
1400-
config,
1401-
token
1402-
) {
1403-
week[token.substr(0, 1)] = toInt(input);
1404-
});
1404+
addWeekParseToken(
1405+
['w', 'ww', 'W', 'WW'],
1406+
function (input, week, config, token) {
1407+
week[token.substr(0, 1)] = toInt(input);
1408+
}
1409+
);
14051410

14061411
// HELPERS
14071412

@@ -1526,9 +1531,8 @@
15261531
return ws.slice(n, 7).concat(ws.slice(0, n));
15271532
}
15281533

1529-
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
1530-
'_'
1531-
),
1534+
var defaultLocaleWeekdays =
1535+
'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
15321536
defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
15331537
defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
15341538
defaultWeekdaysRegex = matchWord,
@@ -2076,6 +2080,11 @@
20762080
return globalLocale;
20772081
}
20782082

2083+
function isLocaleNameSane(name) {
2084+
// Prevent names that look like filesystem paths, i.e contain '/' or '\'
2085+
return name.match('^[^/\\\\]*$') != null;
2086+
}
2087+
20792088
function loadLocale(name) {
20802089
var oldLocale = null,
20812090
aliasedRequire;
@@ -2084,7 +2093,8 @@
20842093
locales[name] === undefined &&
20852094
typeof module !== 'undefined' &&
20862095
module &&
2087-
module.exports
2096+
module.exports &&
2097+
isLocaleNameSane(name)
20882098
) {
20892099
try {
20902100
oldLocale = globalLocale._abbr;
@@ -2301,8 +2311,10 @@
23012311

23022312
// iso 8601 regex
23032313
// 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)
2304-
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)?)?$/,
2305-
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)?)?$/,
2314+
var extendedIsoRegex =
2315+
/^\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)?)?$/,
2316+
basicIsoRegex =
2317+
/^\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)?)?$/,
23062318
tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
23072319
isoDates = [
23082320
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
@@ -2333,7 +2345,8 @@
23332345
],
23342346
aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
23352347
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
2336-
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}))$/,
2348+
rfc2822 =
2349+
/^(?:(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}))$/,
23372350
obsOffsets = {
23382351
UT: 0,
23392352
GMT: 0,
@@ -2356,12 +2369,13 @@
23562369
allowTime,
23572370
dateFormat,
23582371
timeFormat,
2359-
tzFormat;
2372+
tzFormat,
2373+
isoDatesLen = isoDates.length,
2374+
isoTimesLen = isoTimes.length;
23602375

23612376
if (match) {
23622377
getParsingFlags(config).iso = true;
2363-
2364-
for (i = 0, l = isoDates.length; i < l; i++) {
2378+
for (i = 0, l = isoDatesLen; i < l; i++) {
23652379
if (isoDates[i][1].exec(match[1])) {
23662380
dateFormat = isoDates[i][0];
23672381
allowTime = isoDates[i][2] !== false;
@@ -2373,7 +2387,7 @@
23732387
return;
23742388
}
23752389
if (match[3]) {
2376-
for (i = 0, l = isoTimes.length; i < l; i++) {
2390+
for (i = 0, l = isoTimesLen; i < l; i++) {
23772391
if (isoTimes[i][1].exec(match[3])) {
23782392
// match[2] should be 'T' or space
23792393
timeFormat = (match[2] || ' ') + isoTimes[i][0];
@@ -2440,7 +2454,7 @@
24402454
function preprocessRFC2822(s) {
24412455
// Remove comments and folding whitespace and replace multiple-spaces with a single space
24422456
return s
2443-
.replace(/\([^)]*\)|[\n\t]/g, ' ')
2457+
.replace(/\([^()]*\)|[\n\t]/g, ' ')
24442458
.replace(/(\s\s+)/g, ' ')
24452459
.replace(/^\s\s*/, '')
24462460
.replace(/\s\s*$/, '');
@@ -2753,12 +2767,13 @@
27532767
skipped,
27542768
stringLength = string.length,
27552769
totalParsedInputLength = 0,
2756-
era;
2770+
era,
2771+
tokenLen;
27572772

27582773
tokens =
27592774
expandFormat(config._f, config._locale).match(formattingTokens) || [];
2760-
2761-
for (i = 0; i < tokens.length; i++) {
2775+
tokenLen = tokens.length;
2776+
for (i = 0; i < tokenLen; i++) {
27622777
token = tokens[i];
27632778
parsedInput = (string.match(getParseRegexForToken(token, config)) ||
27642779
[])[0];
@@ -2853,15 +2868,16 @@
28532868
i,
28542869
currentScore,
28552870
validFormatFound,
2856-
bestFormatIsValid = false;
2871+
bestFormatIsValid = false,
2872+
configfLen = config._f.length;
28572873

2858-
if (config._f.length === 0) {
2874+
if (configfLen === 0) {
28592875
getParsingFlags(config).invalidFormat = true;
28602876
config._d = new Date(NaN);
28612877
return;
28622878
}
28632879

2864-
for (i = 0; i < config._f.length; i++) {
2880+
for (i = 0; i < configfLen; i++) {
28652881
currentScore = 0;
28662882
validFormatFound = false;
28672883
tempConfig = copyConfig({}, config);
@@ -3102,7 +3118,8 @@
31023118
function isDurationValid(m) {
31033119
var key,
31043120
unitHasDecimal = false,
3105-
i;
3121+
i,
3122+
orderLen = ordering.length;
31063123
for (key in m) {
31073124
if (
31083125
hasOwnProp(m, key) &&
@@ -3115,7 +3132,7 @@
31153132
}
31163133
}
31173134

3118-
for (i = 0; i < ordering.length; ++i) {
3135+
for (i = 0; i < orderLen; ++i) {
31193136
if (m[ordering[i]]) {
31203137
if (unitHasDecimal) {
31213138
return false; // only allow non-integers for smallest unit
@@ -3440,7 +3457,8 @@
34403457
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
34413458
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
34423459
// and further modified to allow for strings containing both week and day
3443-
isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
3460+
isoRegex =
3461+
/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
34443462

34453463
function createDuration(input, key) {
34463464
var duration = input,
@@ -3661,9 +3679,10 @@
36613679
'ms',
36623680
],
36633681
i,
3664-
property;
3682+
property,
3683+
propertyLen = properties.length;
36653684

3666-
for (i = 0; i < properties.length; i += 1) {
3685+
for (i = 0; i < propertyLen; i += 1) {
36673686
property = properties[i];
36683687
propertyTest = propertyTest || hasOwnProp(input, property);
36693688
}
@@ -4286,19 +4305,17 @@
42864305
addRegexToken('NNNN', matchEraName);
42874306
addRegexToken('NNNNN', matchEraNarrow);
42884307

4289-
addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
4290-
input,
4291-
array,
4292-
config,
4293-
token
4294-
) {
4295-
var era = config._locale.erasParse(input, token, config._strict);
4296-
if (era) {
4297-
getParsingFlags(config).era = era;
4298-
} else {
4299-
getParsingFlags(config).invalidEra = input;
4308+
addParseToken(
4309+
['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
4310+
function (input, array, config, token) {
4311+
var era = config._locale.erasParse(input, token, config._strict);
4312+
if (era) {
4313+
getParsingFlags(config).era = era;
4314+
} else {
4315+
getParsingFlags(config).invalidEra = input;
4316+
}
43004317
}
4301-
});
4318+
);
43024319

43034320
addRegexToken('y', matchUnsigned);
43044321
addRegexToken('yy', matchUnsigned);
@@ -4590,14 +4607,12 @@
45904607
addRegexToken('GGGGG', match1to6, match6);
45914608
addRegexToken('ggggg', match1to6, match6);
45924609

4593-
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
4594-
input,
4595-
week,
4596-
config,
4597-
token
4598-
) {
4599-
week[token.substr(0, 2)] = toInt(input);
4600-
});
4610+
addWeekParseToken(
4611+
['gggg', 'ggggg', 'GGGG', 'GGGGG'],
4612+
function (input, week, config, token) {
4613+
week[token.substr(0, 2)] = toInt(input);
4614+
}
4615+
);
46014616

46024617
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
46034618
week[token] = hooks.parseTwoDigitYear(input);
@@ -5620,7 +5635,7 @@
56205635

56215636
//! moment.js
56225637

5623-
hooks.version = '2.29.1';
5638+
hooks.version = '2.29.4';
56245639

56255640
setHookCallback(createLocal);
56265641

0 commit comments

Comments
 (0)