UNPKG

luxon

Version:
1,924 lines (1,923 loc) 5.91 MB
{ "type": "File", "start": 0, "end": 58034, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1707, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 58034, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1707, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 38, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 } }, "imported": { "type": "Identifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 }, "identifierName": "Duration" }, "name": "Duration" }, "local": { "type": "Identifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 }, "identifierName": "Duration" }, "name": "Duration" } } ], "source": { "type": "StringLiteral", "start": 25, "end": 37, "loc": { "start": { "line": 1, "column": 25 }, "end": { "line": 1, "column": 37 } }, "extra": { "rawValue": "./duration", "raw": "'./duration'" }, "value": "./duration" } }, { "type": "ImportDeclaration", "start": 39, "end": 77, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 } }, "imported": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "Interval" }, "name": "Interval" }, "local": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "Interval" }, "name": "Interval" } } ], "source": { "type": "StringLiteral", "start": 64, "end": 76, "loc": { "start": { "line": 2, "column": 25 }, "end": { "line": 2, "column": 37 } }, "extra": { "rawValue": "./interval", "raw": "'./interval'" }, "value": "./interval" } }, { "type": "ImportDeclaration", "start": 78, "end": 116, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 87, "end": 95, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } }, "imported": { "type": "Identifier", "start": 87, "end": 95, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" }, "local": { "type": "Identifier", "start": 87, "end": 95, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" } } ], "source": { "type": "StringLiteral", "start": 103, "end": 115, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 37 } }, "extra": { "rawValue": "./settings", "raw": "'./settings'" }, "value": "./settings" } }, { "type": "ImportDeclaration", "start": 117, "end": 162, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 45 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 126, "end": 135, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 18 } }, "imported": { "type": "Identifier", "start": 126, "end": 135, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 18 }, "identifierName": "Formatter" }, "name": "Formatter" }, "local": { "type": "Identifier", "start": 126, "end": 135, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 18 }, "identifierName": "Formatter" }, "name": "Formatter" } } ], "source": { "type": "StringLiteral", "start": 143, "end": 161, "loc": { "start": { "line": 4, "column": 26 }, "end": { "line": 4, "column": 44 } }, "extra": { "rawValue": "./impl/formatter", "raw": "'./impl/formatter'" }, "value": "./impl/formatter" } }, { "type": "ImportDeclaration", "start": 163, "end": 221, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 58 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 172, "end": 187, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 } }, "imported": { "type": "Identifier", "start": 172, "end": 187, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" }, "local": { "type": "Identifier", "start": 172, "end": 187, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" } } ], "source": { "type": "StringLiteral", "start": 195, "end": 220, "loc": { "start": { "line": 5, "column": 32 }, "end": { "line": 5, "column": 57 } }, "extra": { "rawValue": "./zones/fixedOffsetZone", "raw": "'./zones/fixedOffsetZone'" }, "value": "./zones/fixedOffsetZone" } }, { "type": "ImportDeclaration", "start": 222, "end": 268, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 46 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 231, "end": 240, "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 18 } }, "imported": { "type": "Identifier", "start": 231, "end": 240, "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 18 }, "identifierName": "LocalZone" }, "name": "LocalZone" }, "local": { "type": "Identifier", "start": 231, "end": 240, "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 18 }, "identifierName": "LocalZone" }, "name": "LocalZone" } } ], "source": { "type": "StringLiteral", "start": 248, "end": 267, "loc": { "start": { "line": 6, "column": 26 }, "end": { "line": 6, "column": 45 } }, "extra": { "rawValue": "./zones/localZone", "raw": "'./zones/localZone'" }, "value": "./zones/localZone" } }, { "type": "ImportDeclaration", "start": 269, "end": 308, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 39 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 278, "end": 284, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 15 } }, "imported": { "type": "Identifier", "start": 278, "end": 284, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 15 }, "identifierName": "Locale" }, "name": "Locale" }, "local": { "type": "Identifier", "start": 278, "end": 284, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 15 }, "identifierName": "Locale" }, "name": "Locale" } } ], "source": { "type": "StringLiteral", "start": 292, "end": 307, "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 38 } }, "extra": { "rawValue": "./impl/locale", "raw": "'./impl/locale'" }, "value": "./impl/locale" } }, { "type": "ImportDeclaration", "start": 309, "end": 344, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 35 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 318, "end": 322, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 } }, "imported": { "type": "Identifier", "start": 318, "end": 322, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 }, "identifierName": "Util" }, "name": "Util" }, "local": { "type": "Identifier", "start": 318, "end": 322, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 }, "identifierName": "Util" }, "name": "Util" } } ], "source": { "type": "StringLiteral", "start": 330, "end": 343, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 } }, "extra": { "rawValue": "./impl/util", "raw": "'./impl/util'" }, "value": "./impl/util" } }, { "type": "ImportDeclaration", "start": 345, "end": 394, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 354, "end": 365, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 20 } }, "imported": { "type": "Identifier", "start": 354, "end": 365, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 20 }, "identifierName": "RegexParser" }, "name": "RegexParser" }, "local": { "type": "Identifier", "start": 354, "end": 365, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 20 }, "identifierName": "RegexParser" }, "name": "RegexParser" } } ], "source": { "type": "StringLiteral", "start": 373, "end": 393, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 48 } }, "extra": { "rawValue": "./impl/regexParser", "raw": "'./impl/regexParser'" }, "value": "./impl/regexParser" } }, { "type": "ImportDeclaration", "start": 395, "end": 444, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 404, "end": 415, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 20 } }, "imported": { "type": "Identifier", "start": 404, "end": 415, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 20 }, "identifierName": "TokenParser" }, "name": "TokenParser" }, "local": { "type": "Identifier", "start": 404, "end": 415, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 20 }, "identifierName": "TokenParser" }, "name": "TokenParser" } } ], "source": { "type": "StringLiteral", "start": 423, "end": 443, "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 48 } }, "extra": { "rawValue": "./impl/tokenParser", "raw": "'./impl/tokenParser'" }, "value": "./impl/tokenParser" } }, { "type": "ImportDeclaration", "start": 445, "end": 494, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 454, "end": 465, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 20 } }, "imported": { "type": "Identifier", "start": 454, "end": 465, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 20 }, "identifierName": "Conversions" }, "name": "Conversions" }, "local": { "type": "Identifier", "start": 454, "end": 465, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 20 }, "identifierName": "Conversions" }, "name": "Conversions" } } ], "source": { "type": "StringLiteral", "start": 473, "end": 493, "loc": { "start": { "line": 11, "column": 28 }, "end": { "line": 11, "column": 48 } }, "extra": { "rawValue": "./impl/conversions", "raw": "'./impl/conversions'" }, "value": "./impl/conversions" } }, { "type": "ImportDeclaration", "start": 495, "end": 622, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 17, "column": 18 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 506, "end": 526, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 22 } }, "imported": { "type": "Identifier", "start": 506, "end": 526, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 22 }, "identifierName": "InvalidArgumentError" }, "name": "InvalidArgumentError" }, "local": { "type": "Identifier", "start": 506, "end": 526, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 22 }, "identifierName": "InvalidArgumentError" }, "name": "InvalidArgumentError" } }, { "type": "ImportSpecifier", "start": 530, "end": 559, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 31 } }, "imported": { "type": "Identifier", "start": 530, "end": 559, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 31 }, "identifierName": "ConflictingSpecificationError" }, "name": "ConflictingSpecificationError" }, "local": { "type": "Identifier", "start": 530, "end": 559, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 31 }, "identifierName": "ConflictingSpecificationError" }, "name": "ConflictingSpecificationError" } }, { "type": "ImportSpecifier", "start": 563, "end": 579, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 18 } }, "imported": { "type": "Identifier", "start": 563, "end": 579, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 18 }, "identifierName": "InvalidUnitError" }, "name": "InvalidUnitError" }, "local": { "type": "Identifier", "start": 563, "end": 579, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 18 }, "identifierName": "InvalidUnitError" }, "name": "InvalidUnitError" } }, { "type": "ImportSpecifier", "start": 583, "end": 603, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 22 } }, "imported": { "type": "Identifier", "start": 583, "end": 603, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 22 }, "identifierName": "InvalidDateTimeError" }, "name": "InvalidDateTimeError" }, "local": { "type": "Identifier", "start": 583, "end": 603, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 22 }, "identifierName": "InvalidDateTimeError" }, "name": "InvalidDateTimeError" } } ], "source": { "type": "StringLiteral", "start": 611, "end": 621, "loc": { "start": { "line": 17, "column": 7 }, "end": { "line": 17, "column": 17 } }, "extra": { "rawValue": "./errors", "raw": "'./errors'" }, "value": "./errors" } }, { "type": "VariableDeclaration", "start": 624, "end": 729, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 21, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 630, "end": 658, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 34 } }, "id": { "type": "Identifier", "start": 630, "end": 637, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 13 }, "identifierName": "INVALID" }, "name": "INVALID" }, "init": { "type": "StringLiteral", "start": 640, "end": 658, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 34 } }, "extra": { "rawValue": "Invalid DateTime", "raw": "'Invalid DateTime'" }, "value": "Invalid DateTime" } }, { "type": "VariableDeclarator", "start": 662, "end": 699, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 39 } }, "id": { "type": "Identifier", "start": 662, "end": 678, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 18 }, "identifierName": "UNSUPPORTED_ZONE" }, "name": "UNSUPPORTED_ZONE" }, "init": { "type": "StringLiteral", "start": 681, "end": 699, "loc": { "start": { "line": 20, "column": 21 }, "end": { "line": 20, "column": 39 } }, "extra": { "rawValue": "unsupported zone", "raw": "'unsupported zone'" }, "value": "unsupported zone" } }, { "type": "VariableDeclarator", "start": 703, "end": 728, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 21, "column": 27 } }, "id": { "type": "Identifier", "start": 703, "end": 713, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 21, "column": 12 }, "identifierName": "UNPARSABLE" }, "name": "UNPARSABLE" }, "init": { "type": "StringLiteral", "start": 716, "end": 728, "loc": { "start": { "line": 21, "column": 15 }, "end": { "line": 21, "column": 27 } }, "extra": { "rawValue": "unparsable", "raw": "'unparsable'" }, "value": "unparsable" } } ], "kind": "const" }, { "type": "FunctionDeclaration", "start": 731, "end": 879, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 28, "column": 1 } }, "id": { "type": "Identifier", "start": 740, "end": 762, "loc": { "start": { "line": 23, "column": 9 }, "end": { "line": 23, "column": 31 }, "identifierName": "possiblyCachedWeekData" }, "name": "possiblyCachedWeekData" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 763, "end": 765, "loc": { "start": { "line": 23, "column": 32 }, "end": { "line": 23, "column": 34 }, "identifierName": "dt" }, "name": "dt" } ], "body": { "type": "BlockStatement", "start": 767, "end": 879, "loc": { "start": { "line": 23, "column": 36 }, "end": { "line": 28, "column": 1 } }, "body": [ { "type": "IfStatement", "start": 771, "end": 855, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 3 } }, "test": { "type": "BinaryExpression", "start": 775, "end": 795, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", "start": 775, "end": 786, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 17 } }, "object": { "type": "Identifier", "start": 775, "end": 777, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 8 }, "identifierName": "dt" }, "name": "dt" }, "property": { "type": "Identifier", "start": 778, "end": 786, "loc": { "start": { "line": 24, "column": 9 }, "end": { "line": 24, "column": 17 }, "identifierName": "weekData" }, "name": "weekData" }, "computed": false }, "operator": "===", "right": { "type": "NullLiteral", "start": 791, "end": 795, "loc": { "start": { "line": 24, "column": 22 }, "end": { "line": 24, "column": 26 } } } }, "consequent": { "type": "BlockStatement", "start": 797, "end": 855, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 26, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 803, "end": 851, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 52 } }, "expression": { "type": "AssignmentExpression", "start": 803, "end": 850, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 51 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 803, "end": 814, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 15 } }, "object": { "type": "Identifier", "start": 803, "end": 805, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 6 }, "identifierName": "dt" }, "name": "dt" }, "property": { "type": "Identifier", "start": 806, "end": 814, "loc": { "start": { "line": 25, "column": 7 }, "end": { "line": 25, "column": 15 }, "identifierName": "weekData" }, "name": "weekData" }, "computed": false }, "right": { "type": "CallExpression", "start": 817, "end": 850, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 817, "end": 844, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 45 } }, "object": { "type": "Identifier", "start": 817, "end": 828, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 29 }, "identifierName": "Conversions" }, "name": "Conversions" }, "property": { "type": "Identifier", "start": 829, "end": 844, "loc": { "start": { "line": 25, "column": 30 }, "end": { "line": 25, "column": 45 }, "identifierName": "gregorianToWeek" }, "name": "gregorianToWeek" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 845, "end": 849, "loc": { "start": { "line": 25, "column": 46 }, "end": { "line": 25, "column": 50 } }, "object": { "type": "Identifier", "start": 845, "end": 847, "loc": { "start": { "line": 25, "column": 46 }, "end": { "line": 25, "column": 48 }, "identifierName": "dt" }, "name": "dt" }, "property": { "type": "Identifier", "start": 848, "end": 849, "loc": { "start": { "line": 25, "column": 49 }, "end": { "line": 25, "column": 50 }, "identifierName": "c" }, "name": "c" }, "computed": false } ] } } } ], "directives": [] }, "alternate": null }, { "type": "ReturnStatement", "start": 858, "end": 877, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 21 } }, "argument": { "type": "MemberExpression", "start": 865, "end": 876, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 20 } }, "object": { "type": "Identifier", "start": 865, "end": 867, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 11 }, "identifierName": "dt" }, "name": "dt" }, "property": { "type": "Identifier", "start": 868, "end": 876, "loc": { "start": { "line": 27, "column": 12 }, "end": { "line": 27, "column": 20 }, "identifierName": "weekData" }, "name": "weekData" }, "computed": false } } ], "directives": [] } }, { "type": "FunctionDeclaration", "start": 881, "end": 1141, "loc": { "start": { "line": 30, "column": 0 }, "end": { "line": 40, "column": 1 } }, "id": { "type": "Identifier", "start": 890, "end": 895, "loc": { "start": { "line": 30, "column": 9 }, "end": { "line": 30, "column": 14 }, "identifierName": "clone" }, "name": "clone" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 896, "end": 900, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 }, "identifierName": "inst" }, "name": "inst" }, { "type": "AssignmentPattern", "start": 902, "end": 911, "loc": { "start": { "line": 30, "column": 21 }, "end": { "line": 30, "column": 30 } }, "left": { "type": "Identifier", "start": 902, "end": 906, "loc": { "start": { "line": 30, "column": 21 }, "end": { "line": 30, "column": 25 }, "identifierName": "alts" }, "name": "alts" }, "right": { "type": "ObjectExpression", "start": 909, "end": 911, "loc": { "start": { "line": 30,