MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / configFromString

Function configFromString

tests/test_code/js/moment/moment.js:2511–2538  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

2509
2510 // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
2511 function configFromString(config) {
2512 var matched = aspNetJsonRegex.exec(config._i);
2513 if (matched !== null) {
2514 config._d = new Date(+matched[1]);
2515 return;
2516 }
2517
2518 configFromISO(config);
2519 if (config._isValid === false) {
2520 delete config._isValid;
2521 } else {
2522 return;
2523 }
2524
2525 configFromRFC2822(config);
2526 if (config._isValid === false) {
2527 delete config._isValid;
2528 } else {
2529 return;
2530 }
2531
2532 if (config._strict) {
2533 config._isValid = false;
2534 } else {
2535 // Final attempt, use Input Fallback
2536 hooks.createFromInputFallback(config);
2537 }
2538 }
2539
2540 hooks.createFromInputFallback = deprecate(
2541 '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