UNPKG

luxon

Version:
1,381 lines (1,380 loc) 299 kB
{ "type": "File", "start": 0, "end": 1310, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 71, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1310, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 71, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 36, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 36 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 13, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } }, "imported": { "type": "Identifier", "start": 9, "end": 13, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 }, "identifierName": "Util" }, "name": "Util" }, "local": { "type": "Identifier", "start": 9, "end": 13, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 }, "identifierName": "Util" }, "name": "Util" } } ], "source": { "type": "StringLiteral", "start": 21, "end": 35, "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 35 } }, "extra": { "rawValue": "../impl/util", "raw": "'../impl/util'" }, "value": "../impl/util" } }, { "type": "ImportDeclaration", "start": 37, "end": 68, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 46, "end": 50, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 } }, "imported": { "type": "Identifier", "start": 46, "end": 50, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 }, "identifierName": "Zone" }, "name": "Zone" }, "local": { "type": "Identifier", "start": 46, "end": 50, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 }, "identifierName": "Zone" }, "name": "Zone" } } ], "source": { "type": "StringLiteral", "start": 58, "end": 67, "loc": { "start": { "line": 2, "column": 21 }, "end": { "line": 2, "column": 30 } }, "extra": { "rawValue": "../zone", "raw": "'../zone'" }, "value": "../zone" } }, { "type": "VariableDeclaration", "start": 70, "end": 91, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 21 } }, "declarations": [ { "type": "VariableDeclarator", "start": 74, "end": 90, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 20 } }, "id": { "type": "Identifier", "start": 74, "end": 83, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 13 }, "identifierName": "singleton" }, "name": "singleton" }, "init": { "type": "NullLiteral", "start": 86, "end": 90, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 20 } } } } ], "kind": "let", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @private\n ", "start": 93, "end": 112, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 8, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 114, "end": 1309, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 70, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 121, "end": 1309, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 70, "column": 1 } }, "id": { "type": "Identifier", "start": 127, "end": 142, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 28 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 151, "end": 155, "loc": { "start": { "line": 10, "column": 37 }, "end": { "line": 10, "column": 41 }, "identifierName": "Zone" }, "name": "Zone" }, "body": { "type": "ClassBody", "start": 156, "end": 1309, "loc": { "start": { "line": 10, "column": 42 }, "end": { "line": 70, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 160, "end": 290, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 16, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 171, "end": 182, "loc": { "start": { "line": 11, "column": 13 }, "end": { "line": 11, "column": 24 }, "identifierName": "utcInstance" }, "name": "utcInstance" }, "static": true, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 185, "end": 290, "loc": { "start": { "line": 11, "column": 27 }, "end": { "line": 16, "column": 3 } }, "body": [ { "type": "IfStatement", "start": 191, "end": 264, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 14, "column": 5 } }, "test": { "type": "BinaryExpression", "start": 195, "end": 213, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 26 } }, "left": { "type": "Identifier", "start": 195, "end": 204, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 17 }, "identifierName": "singleton" }, "name": "singleton" }, "operator": "===", "right": { "type": "NullLiteral", "start": 209, "end": 213, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 26 } } } }, "consequent": { "type": "BlockStatement", "start": 215, "end": 264, "loc": { "start": { "line": 12, "column": 28 }, "end": { "line": 14, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 223, "end": 258, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 41 } }, "expression": { "type": "AssignmentExpression", "start": 223, "end": 257, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 40 } }, "operator": "=", "left": { "type": "Identifier", "start": 223, "end": 232, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 15 }, "identifierName": "singleton" }, "name": "singleton" }, "right": { "type": "NewExpression", "start": 235, "end": 257, "loc": { "start": { "line": 13, "column": 18 }, "end": { "line": 13, "column": 40 } }, "callee": { "type": "Identifier", "start": 239, "end": 254, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 37 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" }, "arguments": [ { "type": "NumericLiteral", "start": 255, "end": 256, "loc": { "start": { "line": 13, "column": 38 }, "end": { "line": 13, "column": 39 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } ] } } } ], "directives": [] }, "alternate": null }, { "type": "ReturnStatement", "start": 269, "end": 286, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 21 } }, "argument": { "type": "Identifier", "start": 276, "end": 285, "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 20 }, "identifierName": "singleton" }, "name": "singleton" } } ], "directives": [] } }, { "type": "ClassMethod", "start": 294, "end": 408, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 301, "end": 309, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 17 }, "identifierName": "instance" }, "name": "instance" }, "static": true, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 310, "end": 316, "loc": { "start": { "line": 18, "column": 18 }, "end": { "line": 18, "column": 24 }, "identifierName": "offset" }, "name": "offset" } ], "body": { "type": "BlockStatement", "start": 318, "end": 408, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 324, "end": 404, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 84 } }, "argument": { "type": "ConditionalExpression", "start": 331, "end": 403, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 83 } }, "test": { "type": "BinaryExpression", "start": 331, "end": 343, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 23 } }, "left": { "type": "Identifier", "start": 331, "end": 337, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 17 }, "identifierName": "offset" }, "name": "offset" }, "operator": "===", "right": { "type": "NumericLiteral", "start": 342, "end": 343, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 23 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "consequent": { "type": "MemberExpression", "start": 346, "end": 373, "loc": { "start": { "line": 19, "column": 26 }, "end": { "line": 19, "column": 53 } }, "object": { "type": "Identifier", "start": 346, "end": 361, "loc": { "start": { "line": 19, "column": 26 }, "end": { "line": 19, "column": 41 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" }, "property": { "type": "Identifier", "start": 362, "end": 373, "loc": { "start": { "line": 19, "column": 42 }, "end": { "line": 19, "column": 53 }, "identifierName": "utcInstance" }, "name": "utcInstance" }, "computed": false }, "alternate": { "type": "NewExpression", "start": 376, "end": 403, "loc": { "start": { "line": 19, "column": 56 }, "end": { "line": 19, "column": 83 } }, "callee": { "type": "Identifier", "start": 380, "end": 395, "loc": { "start": { "line": 19, "column": 60 }, "end": { "line": 19, "column": 75 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" }, "arguments": [ { "type": "Identifier", "start": 396, "end": 402, "loc": { "start": { "line": 19, "column": 76 }, "end": { "line": 19, "column": 82 }, "identifierName": "offset" }, "name": "offset" } ] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 412, "end": 634, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 30, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 419, "end": 433, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 23 }, "identifierName": "parseSpecifier" }, "name": "parseSpecifier" }, "static": true, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 434, "end": 435, "loc": { "start": { "line": 22, "column": 24 }, "end": { "line": 22, "column": 25 }, "identifierName": "s" }, "name": "s" } ], "body": { "type": "BlockStatement", "start": 437, "end": 634, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 30, "column": 3 } }, "body": [ { "type": "IfStatement", "start": 443, "end": 613, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 28, "column": 5 } }, "test": { "type": "Identifier", "start": 447, "end": 448, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 9 }, "identifierName": "s" }, "name": "s" }, "consequent": { "type": "BlockStatement", "start": 450, "end": 613, "loc": { "start": { "line": 23, "column": 11 }, "end": { "line": 28, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 458, "end": 517, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 65 } }, "declarations": [ { "type": "VariableDeclarator", "start": 464, "end": 516, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 64 } }, "id": { "type": "Identifier", "start": 464, "end": 465, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 13 }, "identifierName": "r" }, "name": "r" }, "init": { "type": "CallExpression", "start": 468, "end": 516, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 64 } }, "callee": { "type": "MemberExpression", "start": 468, "end": 475, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 23 } }, "object": { "type": "Identifier", "start": 468, "end": 469, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 17 }, "identifierName": "s" }, "name": "s" }, "property": { "type": "Identifier", "start": 470, "end": 475, "loc": { "start": { "line": 24, "column": 18 }, "end": { "line": 24, "column": 23 }, "identifierName": "match" }, "name": "match" }, "computed": false }, "arguments": [ { "type": "RegExpLiteral", "start": 476, "end": 515, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 63 } }, "extra": { "raw": "/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i" }, "pattern": "^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$", "flags": "i" } ] } } ], "kind": "const" }, { "type": "IfStatement", "start": 524, "end": 607, "loc": { "start": { "line": 25, "column": 6 }, "end": { "line": 27, "column": 7 } }, "test": { "type": "Identifier", "start": 528, "end": 529, "loc": { "start": { "line": 25, "column": 10 }, "end": { "line": 25, "column": 11 }, "identifierName": "r" }, "name": "r" }, "consequent": { "type": "BlockStatement", "start": 531, "end": 607, "loc": { "start": { "line": 25, "column": 13 }, "end": { "line": 27, "column": 7 } }, "body": [ { "type": "ReturnStatement", "start": 541, "end": 599, "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 66 } }, "argument": { "type": "NewExpression", "start": 548, "end": 598, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 65 } }, "callee": { "type": "Identifier", "start": 552, "end": 567, "loc": { "start": { "line": 26, "column": 19 }, "end": { "line": 26, "column": 34 }, "identifierName": "FixedOffsetZone" }, "name": "FixedOffsetZone" }, "arguments": [ { "type": "CallExpression", "start": 568, "end": 597, "loc": { "start": { "line": 26, "column": 35 }, "end": { "line": 26, "column": 64 } }, "callee": { "type": "MemberExpression", "start": 568, "end": 585, "loc": { "start": { "line": 26, "column": 35 }, "end": { "line": 26, "column": 52 } }, "object": { "type": "Identifier", "start": 568, "end": 572, "loc": { "start": { "line": 26, "column": 35 }, "end": { "line": 26, "column": 39 }, "identifierName": "Util" }, "name": "Util" }, "property": { "type": "Identifier", "start": 573, "end": 585, "loc": { "start": { "line": 26, "column": 40 }, "end": { "line": 26, "column": 52 }, "identifierName": "signedOffset" }, "name": "signedOffset" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 586, "end": 590, "loc": { "start": { "line": 26, "column": 53 }, "end": { "line": 26, "column": 57 } }, "object": { "type": "Identifier", "start": 586, "end": 587, "loc": { "start": { "line": 26, "column": 53 }, "end": { "line": 26, "column": 54 }, "identifierName": "r" }, "name": "r" }, "property": { "type": "NumericLiteral", "start": 588, "end": 589, "loc": { "start": { "line": 26, "column": 55 }, "end": { "line": 26, "column": 56 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "computed": true }, { "type": "MemberExpression", "start": 592, "end": 596, "loc": { "start": { "line": 26, "column": 59 }, "end": { "line": 26, "column": 63 } }, "object": { "type": "Identifier",