MCPcopy
hub / github.com/tdewolff/minify / checkOverflow

Function checkOverflow

_benchmarks/sample_moment.js:2331–2373  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

2329 }
2330
2331 function checkOverflow(m) {
2332 var overflow,
2333 a = m._a;
2334
2335 if (a && getParsingFlags(m).overflow === -2) {
2336 overflow =
2337 a[MONTH] < 0 || a[MONTH] > 11
2338 ? MONTH
2339 : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
2340 ? DATE
2341 : a[HOUR] < 0 ||
2342 a[HOUR] > 24 ||
2343 (a[HOUR] === 24 &&
2344 (a[MINUTE] !== 0 ||
2345 a[SECOND] !== 0 ||
2346 a[MILLISECOND] !== 0))
2347 ? HOUR
2348 : a[MINUTE] < 0 || a[MINUTE] > 59
2349 ? MINUTE
2350 : a[SECOND] < 0 || a[SECOND] > 59
2351 ? SECOND
2352 : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
2353 ? MILLISECOND
2354 : -1;
2355
2356 if (
2357 getParsingFlags(m)._overflowDayOfYear &&
2358 (overflow < YEAR || overflow > DATE)
2359 ) {
2360 overflow = DATE;
2361 }
2362 if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
2363 overflow = WEEK;
2364 }
2365 if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
2366 overflow = WEEKDAY;
2367 }
2368
2369 getParsingFlags(m).overflow = overflow;
2370 }
2371
2372 return m;
2373 }
2374
2375 // iso 8601 regex
2376 // 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)

Callers 3

createFromConfigFunction · 0.70
prepareConfigFunction · 0.70

Calls 2

getParsingFlagsFunction · 0.85
daysInMonthFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…