UNPKG

luxon

Version:
1,505 lines 115 kB
{ "type": "File", "start": 0, "end": 1777, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1777, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 35, "end": 82, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 47 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 44, "end": 63, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 28 } }, "imported": { "type": "Identifier", "start": 44, "end": 63, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 28 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError", "leadingComments": null }, "local": { "type": "Identifier", "start": 44, "end": 63, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 28 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "leadingComments": null } ], "source": { "type": "StringLiteral", "start": 71, "end": 81, "loc": { "start": { "line": 2, "column": 36 }, "end": { "line": 2, "column": 46 } }, "extra": { "rawValue": "./errors", "raw": "'./errors'" }, "value": "./errors" }, "leadingComments": [ { "type": "CommentBlock", "value": " eslint no-unused-vars: \"off\" ", "start": 0, "end": 34, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 34 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @interface\n", "start": 84, "end": 104, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 2 } } } ] }, { "type": "ExportNamedDeclaration", "start": 105, "end": 1776, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 76, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 112, "end": 1776, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 76, "column": 1 } }, "id": { "type": "Identifier", "start": 118, "end": 122, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 17 }, "identifierName": "Zone" }, "name": "Zone", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 123, "end": 1776, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 76, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 198, "end": 251, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 15, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 202, "end": 206, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 10 }, "identifierName": "type" }, "name": "type" }, "static": false, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 209, "end": 251, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 15, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 215, "end": 247, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 36 } }, "argument": { "type": "NewExpression", "start": 221, "end": 246, "loc": { "start": { "line": 14, "column": 10 }, "end": { "line": 14, "column": 35 } }, "callee": { "type": "Identifier", "start": 225, "end": 244, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * The type of zone\n * @abstract\n * @return {string}\n ", "start": 127, "end": 195, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 12, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * The name of this zone.\n * @abstract\n * @return {string}\n ", "start": 255, "end": 329, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 21, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 332, "end": 385, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 336, "end": 340, "loc": { "start": { "line": 22, "column": 6 }, "end": { "line": 22, "column": 10 }, "identifierName": "name" }, "name": "name" }, "static": false, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 343, "end": 385, "loc": { "start": { "line": 22, "column": 13 }, "end": { "line": 24, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 349, "end": 381, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 36 } }, "argument": { "type": "NewExpression", "start": 355, "end": 380, "loc": { "start": { "line": 23, "column": 10 }, "end": { "line": 23, "column": 35 } }, "callee": { "type": "Identifier", "start": 359, "end": 378, "loc": { "start": { "line": 23, "column": 14 }, "end": { "line": 23, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * The name of this zone.\n * @abstract\n * @return {string}\n ", "start": 255, "end": 329, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 21, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @return {boolean}\n ", "start": 389, "end": 509, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 30, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 512, "end": 570, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 33, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 516, "end": 525, "loc": { "start": { "line": 31, "column": 6 }, "end": { "line": 31, "column": 15 }, "identifierName": "universal" }, "name": "universal" }, "static": false, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 528, "end": 570, "loc": { "start": { "line": 31, "column": 18 }, "end": { "line": 33, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 534, "end": 566, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 36 } }, "argument": { "type": "NewExpression", "start": 540, "end": 565, "loc": { "start": { "line": 32, "column": 10 }, "end": { "line": 32, "column": 35 } }, "callee": { "type": "Identifier", "start": 544, "end": 563, "loc": { "start": { "line": 32, "column": 14 }, "end": { "line": 32, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @return {boolean}\n ", "start": 389, "end": 509, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 30, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} options - Options to affect the format\n * @param {string} options.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} options.localeCode - What locale to return the offset name in. Defaults to us-en\n * @return {string}\n ", "start": 574, "end": 1029, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 43, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1032, "end": 1144, "loc": { "start": { "line": 44, "column": 2 }, "end": { "line": 46, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 1039, "end": 1049, "loc": { "start": { "line": 44, "column": 9 }, "end": { "line": 44, "column": 19 }, "identifierName": "offsetName" }, "name": "offsetName" }, "static": true, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1050, "end": 1052, "loc": { "start": { "line": 44, "column": 20 }, "end": { "line": 44, "column": 22 }, "identifierName": "ts" }, "name": "ts" }, { "type": "AssignmentPattern", "start": 1054, "end": 1100, "loc": { "start": { "line": 44, "column": 24 }, "end": { "line": 44, "column": 70 } }, "left": { "type": "ObjectPattern", "start": 1054, "end": 1095, "loc": { "start": { "line": 44, "column": 24 }, "end": { "line": 44, "column": 65 } }, "properties": [ { "type": "ObjectProperty", "start": 1056, "end": 1071, "loc": { "start": { "line": 44, "column": 26 }, "end": { "line": 44, "column": 41 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1056, "end": 1062, "loc": { "start": { "line": 44, "column": 26 }, "end": { "line": 44, "column": 32 }, "identifierName": "format" }, "name": "format" }, "value": { "type": "AssignmentPattern", "start": 1056, "end": 1071, "loc": { "start": { "line": 44, "column": 26 }, "end": { "line": 44, "column": 41 } }, "left": { "type": "Identifier", "start": 1056, "end": 1062, "loc": { "start": { "line": 44, "column": 26 }, "end": { "line": 44, "column": 32 }, "identifierName": "format" }, "name": "format" }, "right": { "type": "StringLiteral", "start": 1065, "end": 1071, "loc": { "start": { "line": 44, "column": 35 }, "end": { "line": 44, "column": 41 } }, "extra": { "rawValue": "long", "raw": "'long'" }, "value": "long" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1073, "end": 1093, "loc": { "start": { "line": 44, "column": 43 }, "end": { "line": 44, "column": 63 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1073, "end": 1083, "loc": { "start": { "line": 44, "column": 43 }, "end": { "line": 44, "column": 53 }, "identifierName": "localeCode" }, "name": "localeCode" }, "value": { "type": "AssignmentPattern", "start": 1073, "end": 1093, "loc": { "start": { "line": 44, "column": 43 }, "end": { "line": 44, "column": 63 } }, "left": { "type": "Identifier", "start": 1073, "end": 1083, "loc": { "start": { "line": 44, "column": 43 }, "end": { "line": 44, "column": 53 }, "identifierName": "localeCode" }, "name": "localeCode" }, "right": { "type": "StringLiteral", "start": 1086, "end": 1093, "loc": { "start": { "line": 44, "column": 56 }, "end": { "line": 44, "column": 63 } }, "extra": { "rawValue": "en-US", "raw": "'en-US'" }, "value": "en-US" } }, "extra": { "shorthand": true } } ] }, "right": { "type": "ObjectExpression", "start": 1098, "end": 1100, "loc": { "start": { "line": 44, "column": 68 }, "end": { "line": 44, "column": 70 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 1102, "end": 1144, "loc": { "start": { "line": 44, "column": 72 }, "end": { "line": 46, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 1108, "end": 1140, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 36 } }, "argument": { "type": "NewExpression", "start": 1114, "end": 1139, "loc": { "start": { "line": 45, "column": 10 }, "end": { "line": 45, "column": 35 } }, "callee": { "type": "Identifier", "start": 1118, "end": 1137, "loc": { "start": { "line": 45, "column": 14 }, "end": { "line": 45, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} options - Options to affect the format\n * @param {string} options.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} options.localeCode - What locale to return the offset name in. Defaults to us-en\n * @return {string}\n ", "start": 574, "end": 1029, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 43, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n ", "start": 1148, "end": 1347, "loc": { "start": { "line": 48, "column": 2 }, "end": { "line": 53, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1350, "end": 1403, "loc": { "start": { "line": 54, "column": 2 }, "end": { "line": 56, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 1350, "end": 1356, "loc": { "start": { "line": 54, "column": 2 }, "end": { "line": 54, "column": 8 }, "identifierName": "offset" }, "name": "offset", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1357, "end": 1359, "loc": { "start": { "line": 54, "column": 9 }, "end": { "line": 54, "column": 11 }, "identifierName": "ts" }, "name": "ts" } ], "body": { "type": "BlockStatement", "start": 1361, "end": 1403, "loc": { "start": { "line": 54, "column": 13 }, "end": { "line": 56, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 1367, "end": 1399, "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 36 } }, "argument": { "type": "NewExpression", "start": 1373, "end": 1398, "loc": { "start": { "line": 55, "column": 10 }, "end": { "line": 55, "column": 35 } }, "callee": { "type": "Identifier", "start": 1377, "end": 1396, "loc": { "start": { "line": 55, "column": 14 }, "end": { "line": 55, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n ", "start": 1148, "end": 1347, "loc": { "start": { "line": 48, "column": 2 }, "end": { "line": 53, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Return whether this Zone is equal to another zoner\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n ", "start": 1407, "end": 1561, "loc": { "start": { "line": 58, "column": 2 }, "end": { "line": 63, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1564, "end": 1624, "loc": { "start": { "line": 64, "column": 2 }, "end": { "line": 66, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 1564, "end": 1570, "loc": { "start": { "line": 64, "column": 2 }, "end": { "line": 64, "column": 8 }, "identifierName": "equals" }, "name": "equals", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1571, "end": 1580, "loc": { "start": { "line": 64, "column": 9 }, "end": { "line": 64, "column": 18 }, "identifierName": "otherZone" }, "name": "otherZone" } ], "body": { "type": "BlockStatement", "start": 1582, "end": 1624, "loc": { "start": { "line": 64, "column": 20 }, "end": { "line": 66, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 1588, "end": 1620, "loc": { "start": { "line": 65, "column": 4 }, "end": { "line": 65, "column": 36 } }, "argument": { "type": "NewExpression", "start": 1594, "end": 1619, "loc": { "start": { "line": 65, "column": 10 }, "end": { "line": 65, "column": 35 } }, "callee": { "type": "Identifier", "start": 1598, "end": 1617, "loc": { "start": { "line": 65, "column": 14 }, "end": { "line": 65, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Return whether this Zone is equal to another zoner\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n ", "start": 1407, "end": 1561, "loc": { "start": { "line": 58, "column": 2 }, "end": { "line": 63, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Return whether this Zone is valid.\n * @abstract\n * @return {boolean}\n ", "start": 1628, "end": 1715, "loc": { "start": { "line": 68, "column": 2 }, "end": { "line": 72, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1718, "end": 1774, "loc": { "start": { "line": 73, "column": 2 }, "end": { "line": 75, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 1722, "end": 1729, "loc": { "start": { "line": 73, "column": 6 }, "end": { "line": 73, "column": 13 }, "identifierName": "isValid" }, "name": "isValid" }, "static": false, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1732, "end": 1774, "loc": { "start": { "line": 73, "column": 16 }, "end": { "line": 75, "column": 3 } }, "body": [ { "type": "ThrowStatement", "start": 1738, "end": 1770, "loc": { "start": { "line": 74, "column": 4 }, "end": { "line": 74, "column": 36 } }, "argument": { "type": "NewExpression", "start": 1744, "end": 1769, "loc": { "start": { "line": 74, "column": 10 }, "end": { "line": 74, "column": 35 } }, "callee": { "type": "Identifier", "start": 1748, "end": 1767, "loc": { "start": { "line": 74, "column": 14 }, "end": { "line": 74, "column": 33 }, "identifierName": "ZoneIsAbstractError" }, "name": "ZoneIsAbstractError" }, "arguments": [] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Return whether this Zone is valid.\n * @abstract\n * @return {boolean}\n ", "start": 1628, "end": 1715, "loc": { "start": { "line": 68, "column": 2 }, "end": { "line": 72, "column": 5 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @interface\n", "start": 84, "end": 104, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 6, "column": 2 } } } ], "trailingComments": [