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

Function configFromString

_benchmarks/sample_moment.js:2588–2615  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

2586
2587 // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
2588 function configFromString(config) {
2589 var matched = aspNetJsonRegex.exec(config._i);
2590 if (matched !== null) {
2591 config._d = new Date(+matched[1]);
2592 return;
2593 }
2594
2595 configFromISO(config);
2596 if (config._isValid === false) {
2597 delete config._isValid;
2598 } else {
2599 return;
2600 }
2601
2602 configFromRFC2822(config);
2603 if (config._isValid === false) {
2604 delete config._isValid;
2605 } else {
2606 return;
2607 }
2608
2609 if (config._strict) {
2610 config._isValid = false;
2611 } else {
2612 // Final attempt, use Input Fallback
2613 hooks.createFromInputFallback(config);
2614 }
2615 }
2616
2617 hooks.createFromInputFallback = deprecate(
2618 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +

Callers 1

configFromInputFunction · 0.85

Calls 2

configFromISOFunction · 0.85
configFromRFC2822Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…