UNPKG

luxon

Version:
1,581 lines 1.95 MB
{ "type": "File", "start": 0, "end": 15285, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 473, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 15285, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 473, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 35, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 35 } }, "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": 34, "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 34 } }, "extra": { "rawValue": "./impl/util", "raw": "'./impl/util'" }, "value": "./impl/util" } }, { "type": "ImportDeclaration", "start": 36, "end": 74, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 45, "end": 53, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 } }, "imported": { "type": "Identifier", "start": 45, "end": 53, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "DateTime" }, "name": "DateTime" }, "local": { "type": "Identifier", "start": 45, "end": 53, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "DateTime" }, "name": "DateTime" } } ], "source": { "type": "StringLiteral", "start": 61, "end": 73, "loc": { "start": { "line": 2, "column": 25 }, "end": { "line": 2, "column": 37 } }, "extra": { "rawValue": "./datetime", "raw": "'./datetime'" }, "value": "./datetime" } }, { "type": "ImportDeclaration", "start": 75, "end": 113, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 84, "end": 92, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } }, "imported": { "type": "Identifier", "start": 84, "end": 92, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 }, "identifierName": "Duration" }, "name": "Duration" }, "local": { "type": "Identifier", "start": 84, "end": 92, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 }, "identifierName": "Duration" }, "name": "Duration" } } ], "source": { "type": "StringLiteral", "start": 100, "end": 112, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 37 } }, "extra": { "rawValue": "./duration", "raw": "'./duration'" }, "value": "./duration" } }, { "type": "ImportDeclaration", "start": 114, "end": 152, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 123, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 17 } }, "imported": { "type": "Identifier", "start": 123, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" }, "local": { "type": "Identifier", "start": 123, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" } } ], "source": { "type": "StringLiteral", "start": 139, "end": 151, "loc": { "start": { "line": 4, "column": 25 }, "end": { "line": 4, "column": 37 } }, "extra": { "rawValue": "./settings", "raw": "'./settings'" }, "value": "./settings" } }, { "type": "ImportDeclaration", "start": 153, "end": 223, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 70 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 162, "end": 182, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 29 } }, "imported": { "type": "Identifier", "start": 162, "end": 182, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 29 }, "identifierName": "InvalidArgumentError" }, "name": "InvalidArgumentError" }, "local": { "type": "Identifier", "start": 162, "end": 182, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 29 }, "identifierName": "InvalidArgumentError" }, "name": "InvalidArgumentError" } }, { "type": "ImportSpecifier", "start": 184, "end": 204, "loc": { "start": { "line": 5, "column": 31 }, "end": { "line": 5, "column": 51 } }, "imported": { "type": "Identifier", "start": 184, "end": 204, "loc": { "start": { "line": 5, "column": 31 }, "end": { "line": 5, "column": 51 }, "identifierName": "InvalidIntervalError" }, "name": "InvalidIntervalError" }, "local": { "type": "Identifier", "start": 184, "end": 204, "loc": { "start": { "line": 5, "column": 31 }, "end": { "line": 5, "column": 51 }, "identifierName": "InvalidIntervalError" }, "name": "InvalidIntervalError" } } ], "source": { "type": "StringLiteral", "start": 212, "end": 222, "loc": { "start": { "line": 5, "column": 59 }, "end": { "line": 5, "column": 69 } }, "extra": { "rawValue": "./errors", "raw": "'./errors'" }, "value": "./errors" } }, { "type": "VariableDeclaration", "start": 225, "end": 260, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", "start": 231, "end": 259, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 34 } }, "id": { "type": "Identifier", "start": 231, "end": 238, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 13 }, "identifierName": "INVALID" }, "name": "INVALID" }, "init": { "type": "StringLiteral", "start": 241, "end": 259, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 34 } }, "extra": { "rawValue": "Invalid Interval", "raw": "'Invalid Interval'" }, "value": "Invalid Interval" } } ], "kind": "const" }, { "type": "FunctionDeclaration", "start": 262, "end": 378, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 11, "column": 1 } }, "id": { "type": "Identifier", "start": 271, "end": 287, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 25 }, "identifierName": "validateStartEnd" }, "name": "validateStartEnd" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 288, "end": 293, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 9, "column": 31 }, "identifierName": "start" }, "name": "start" }, { "type": "Identifier", "start": 295, "end": 298, "loc": { "start": { "line": 9, "column": 33 }, "end": { "line": 9, "column": 36 }, "identifierName": "end" }, "name": "end" } ], "body": { "type": "BlockStatement", "start": 300, "end": 378, "loc": { "start": { "line": 9, "column": 38 }, "end": { "line": 11, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 304, "end": 376, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 74 } }, "argument": { "type": "LogicalExpression", "start": 311, "end": 375, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 73 } }, "left": { "type": "LogicalExpression", "start": 311, "end": 359, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 57 } }, "left": { "type": "LogicalExpression", "start": 311, "end": 344, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 42 } }, "left": { "type": "LogicalExpression", "start": 311, "end": 327, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 25 } }, "left": { "type": "UnaryExpression", "start": 311, "end": 318, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 10, "column": 16 } }, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", "start": 312, "end": 318, "loc": { "start": { "line": 10, "column": 10 }, "end": { "line": 10, "column": 16 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 313, "end": 318, "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 16 }, "identifierName": "start" }, "name": "start" }, "extra": { "parenthesizedArgument": false } }, "extra": { "parenthesizedArgument": false } }, "operator": "&&", "right": { "type": "UnaryExpression", "start": 322, "end": 327, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 25 } }, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", "start": 323, "end": 327, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 25 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 324, "end": 327, "loc": { "start": { "line": 10, "column": 22 }, "end": { "line": 10, "column": 25 }, "identifierName": "end" }, "name": "end" }, "extra": { "parenthesizedArgument": false } }, "extra": { "parenthesizedArgument": false } } }, "operator": "&&", "right": { "type": "MemberExpression", "start": 331, "end": 344, "loc": { "start": { "line": 10, "column": 29 }, "end": { "line": 10, "column": 42 } }, "object": { "type": "Identifier", "start": 331, "end": 336, "loc": { "start": { "line": 10, "column": 29 }, "end": { "line": 10, "column": 34 }, "identifierName": "start" }, "name": "start" }, "property": { "type": "Identifier", "start": 337, "end": 344, "loc": { "start": { "line": 10, "column": 35 }, "end": { "line": 10, "column": 42 }, "identifierName": "isValid" }, "name": "isValid" }, "computed": false } }, "operator": "&&", "right": { "type": "MemberExpression", "start": 348, "end": 359, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 10, "column": 57 } }, "object": { "type": "Identifier", "start": 348, "end": 351, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 10, "column": 49 }, "identifierName": "end" }, "name": "end" }, "property": { "type": "Identifier", "start": 352, "end": 359, "loc": { "start": { "line": 10, "column": 50 }, "end": { "line": 10, "column": 57 }, "identifierName": "isValid" }, "name": "isValid" }, "computed": false } }, "operator": "&&", "right": { "type": "BinaryExpression", "start": 363, "end": 375, "loc": { "start": { "line": 10, "column": 61 }, "end": { "line": 10, "column": 73 } }, "left": { "type": "Identifier", "start": 363, "end": 368, "loc": { "start": { "line": 10, "column": 61 }, "end": { "line": 10, "column": 66 }, "identifierName": "start" }, "name": "start" }, "operator": "<=", "right": { "type": "Identifier", "start": 372, "end": 375, "loc": { "start": { "line": 10, "column": 70 }, "end": { "line": 10, "column": 73 }, "identifierName": "end" }, "name": "end" } } } } ], "directives": [], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.\n * * **Accessors** Use {@link start} and {@link end} to get the start and end.\n * * **Interogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.\n * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}\n * * **Output*** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toFormat}, and {@link toDuration}.\n ", "start": 380, "end": 1632, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 24, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 1633, "end": 15284, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 472, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 1640, "end": 15284, "loc": { "start": { "line": 25, "column": 7 }, "end": { "line": 472, "column": 1 } }, "id": { "type": "Identifier", "start": 1646, "end": 1654, "loc": { "start": { "line": 25, "column": 13 }, "end": { "line": 25, "column": 21 }, "identifierName": "Interval" }, "name": "Interval", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 1655, "end": 15284, "loc": { "start": { "line": 25, "column": 22 }, "end": { "line": 472, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 1685, "end": 1996, "loc": { "start": { "line": 29, "column": 2 }, "end": { "line": 36, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 1685, "end": 1696, "loc": { "start": { "line": 29, "column": 2 }, "end": { "line": 29, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1697, "end": 1703, "loc": { "start": { "line": 29, "column": 14 }, "end": { "line": 29, "column": 20 }, "identifierName": "config" }, "name": "config" } ], "body": { "type": "BlockStatement", "start": 1705, "end": 1996, "loc": { "start": { "line": 29, "column": 22 }, "end": { "line": 36, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1711, "end": 1787, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 80 } }, "expression": { "type": "CallExpression", "start": 1711, "end": 1786, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 79 } }, "callee": { "type": "MemberExpression", "start": 1711, "end": 1732, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 25 } }, "object": { "type": "Identifier", "start": 1711, "end": 1717, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 10 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 1718, "end": 1732, "loc": { "start": { "line": 30, "column": 11 }, "end": { "line": 30, "column": 25 }, "identifierName": "defineProperty" }, "name": "defineProperty" }, "computed": false }, "arguments": [ { "type": "ThisExpression", "start": 1733, "end": 1737, "loc": { "start": { "line": 30, "column": 26 }, "end": { "line": 30, "column": 30 } } }, { "type": "StringLiteral", "start": 1739, "end": 1742, "loc": { "start": { "line": 30, "column": 32 }, "end": { "line": 30, "column": 35 } }, "extra": { "rawValue": "s", "raw": "'s'" }, "value": "s" }, { "type": "ObjectExpression", "start": 1744, "end": 1785, "loc": { "start": { "line": 30, "column": 37 }, "end": { "line": 30, "column": 78 } }, "properties": [ { "type": "ObjectProperty", "start": 1746, "end": 1765, "loc": { "start": { "line": 30, "column": 39 }, "end": { "line": 30, "column": 58 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1746, "end": 1751, "loc": { "start": { "line": 30, "column": 39 }, "end": { "line": 30, "column": 44 }, "identifierName": "value" }, "name": "value" }, "value": { "type": "MemberExpression", "start": 1753, "end": 1765, "loc": { "start": { "line": 30, "column": 46 }, "end": { "line": 30, "column": 58 } }, "object": { "type": "Identifier", "start": 1753, "end": 1759, "loc": { "start": { "line": 30, "column": 46 }, "end": { "line": 30, "column": 52 }, "identifierName": "config" }, "name": "config" }, "property": { "type": "Identifier", "start": 1760, "end": 1765, "loc": { "start": { "line": 30, "column": 53 }, "end": { "line": 30, "column": 58 }, "identifierName": "start" }, "name": "start" }, "computed": false } }, { "type": "ObjectProperty", "start": 1767, "end": 1783, "loc": { "start": { "line": 30, "column": 60 }, "end": { "line": 30, "column": 76 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1767, "end": 1777, "loc": { "start": { "line": 30, "column": 60 }, "end": { "line": 30, "column": 70 }, "identifierName": "enumerable" }, "name": "enumerable" }, "value": { "type": "BooleanLiteral", "start": 1779, "end": 1783, "loc": { "start": { "line": 30, "column": 72 }, "end": { "line": 30, "column": 76 } }, "value": true } } ] } ] } }, { "type": "ExpressionStatement", "start": 1792, "end": 1866, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 78 } }, "expression": { "type": "CallExpression", "start": 1792, "end": 1865, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 77 } }, "callee": { "type": "MemberExpression", "start": 1792, "end": 1813, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 25 } }, "object": { "type": "Identifier", "start": 1792, "end": 1798, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 10 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 1799, "end": 1813, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 25 }, "identifierName": "defineProperty" }, "name": "defineProperty" }, "computed": false }, "arguments": [ { "type": "ThisExpression", "start": 1814, "end": 1818, "loc": { "start": { "line": 31, "column": 26 }, "end": { "line": 31, "column": 30 } } }, { "type": "StringLiteral", "start": 1820, "end": 1823, "loc": { "start": { "line": 31, "column": 32 }, "end": { "line": 31, "column": 35 } }, "extra": { "rawValue": "e", "raw": "'e'" }, "value": "e" }, { "type": "ObjectExpression", "start": 1825, "end": 1864, "loc": { "start": { "line": 31, "column": 37 }, "end": { "line": 31, "column": 76 } }, "properties": [ { "type": "ObjectProperty", "start": 1827, "end": 1844, "loc": { "start": { "line": 31, "column": 39 }, "end": { "line": 31, "column": 56 } }, "meth