UNPKG

luxon

Version:
1,607 lines (1,606 loc) 1.07 MB
{ "type": "File", "start": 0, "end": 4556, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 152, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 4556, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 152, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 30, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 30 } }, "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": 29, "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 29 } }, "extra": { "rawValue": "./util", "raw": "'./util'" }, "value": "./util" } }, { "type": "VariableDeclaration", "start": 32, "end": 182, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 4, "column": 71 } }, "declarations": [ { "type": "VariableDeclarator", "start": 38, "end": 109, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 77 } }, "id": { "type": "Identifier", "start": 38, "end": 51, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 19 }, "identifierName": "nonLeapLadder" }, "name": "nonLeapLadder" }, "init": { "type": "ArrayExpression", "start": 54, "end": 109, "loc": { "start": { "line": 3, "column": 22 }, "end": { "line": 3, "column": 77 } }, "elements": [ { "type": "NumericLiteral", "start": 55, "end": 56, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 24 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, { "type": "NumericLiteral", "start": 58, "end": 60, "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 28 } }, "extra": { "rawValue": 31, "raw": "31" }, "value": 31 }, { "type": "NumericLiteral", "start": 62, "end": 64, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 32 } }, "extra": { "rawValue": 59, "raw": "59" }, "value": 59 }, { "type": "NumericLiteral", "start": 66, "end": 68, "loc": { "start": { "line": 3, "column": 34 }, "end": { "line": 3, "column": 36 } }, "extra": { "rawValue": 90, "raw": "90" }, "value": 90 }, { "type": "NumericLiteral", "start": 70, "end": 73, "loc": { "start": { "line": 3, "column": 38 }, "end": { "line": 3, "column": 41 } }, "extra": { "rawValue": 120, "raw": "120" }, "value": 120 }, { "type": "NumericLiteral", "start": 75, "end": 78, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 46 } }, "extra": { "rawValue": 151, "raw": "151" }, "value": 151 }, { "type": "NumericLiteral", "start": 80, "end": 83, "loc": { "start": { "line": 3, "column": 48 }, "end": { "line": 3, "column": 51 } }, "extra": { "rawValue": 181, "raw": "181" }, "value": 181 }, { "type": "NumericLiteral", "start": 85, "end": 88, "loc": { "start": { "line": 3, "column": 53 }, "end": { "line": 3, "column": 56 } }, "extra": { "rawValue": 212, "raw": "212" }, "value": 212 }, { "type": "NumericLiteral", "start": 90, "end": 93, "loc": { "start": { "line": 3, "column": 58 }, "end": { "line": 3, "column": 61 } }, "extra": { "rawValue": 243, "raw": "243" }, "value": 243 }, { "type": "NumericLiteral", "start": 95, "end": 98, "loc": { "start": { "line": 3, "column": 63 }, "end": { "line": 3, "column": 66 } }, "extra": { "rawValue": 273, "raw": "273" }, "value": 273 }, { "type": "NumericLiteral", "start": 100, "end": 103, "loc": { "start": { "line": 3, "column": 68 }, "end": { "line": 3, "column": 71 } }, "extra": { "rawValue": 304, "raw": "304" }, "value": 304 }, { "type": "NumericLiteral", "start": 105, "end": 108, "loc": { "start": { "line": 3, "column": 73 }, "end": { "line": 3, "column": 76 } }, "extra": { "rawValue": 334, "raw": "334" }, "value": 334 } ] } }, { "type": "VariableDeclarator", "start": 113, "end": 181, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 70 } }, "id": { "type": "Identifier", "start": 113, "end": 123, "loc": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 12 }, "identifierName": "leapLadder" }, "name": "leapLadder" }, "init": { "type": "ArrayExpression", "start": 126, "end": 181, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 70 } }, "elements": [ { "type": "NumericLiteral", "start": 127, "end": 128, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 17 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, { "type": "NumericLiteral", "start": 130, "end": 132, "loc": { "start": { "line": 4, "column": 19 }, "end": { "line": 4, "column": 21 } }, "extra": { "rawValue": 31, "raw": "31" }, "value": 31 }, { "type": "NumericLiteral", "start": 134, "end": 136, "loc": { "start": { "line": 4, "column": 23 }, "end": { "line": 4, "column": 25 } }, "extra": { "rawValue": 60, "raw": "60" }, "value": 60 }, { "type": "NumericLiteral", "start": 138, "end": 140, "loc": { "start": { "line": 4, "column": 27 }, "end": { "line": 4, "column": 29 } }, "extra": { "rawValue": 91, "raw": "91" }, "value": 91 }, { "type": "NumericLiteral", "start": 142, "end": 145, "loc": { "start": { "line": 4, "column": 31 }, "end": { "line": 4, "column": 34 } }, "extra": { "rawValue": 121, "raw": "121" }, "value": 121 }, { "type": "NumericLiteral", "start": 147, "end": 150, "loc": { "start": { "line": 4, "column": 36 }, "end": { "line": 4, "column": 39 } }, "extra": { "rawValue": 152, "raw": "152" }, "value": 152 }, { "type": "NumericLiteral", "start": 152, "end": 155, "loc": { "start": { "line": 4, "column": 41 }, "end": { "line": 4, "column": 44 } }, "extra": { "rawValue": 182, "raw": "182" }, "value": 182 }, { "type": "NumericLiteral", "start": 157, "end": 160, "loc": { "start": { "line": 4, "column": 46 }, "end": { "line": 4, "column": 49 } }, "extra": { "rawValue": 213, "raw": "213" }, "value": 213 }, { "type": "NumericLiteral", "start": 162, "end": 165, "loc": { "start": { "line": 4, "column": 51 }, "end": { "line": 4, "column": 54 } }, "extra": { "rawValue": 244, "raw": "244" }, "value": 244 }, { "type": "NumericLiteral", "start": 167, "end": 170, "loc": { "start": { "line": 4, "column": 56 }, "end": { "line": 4, "column": 59 } }, "extra": { "rawValue": 274, "raw": "274" }, "value": 274 }, { "type": "NumericLiteral", "start": 172, "end": 175, "loc": { "start": { "line": 4, "column": 61 }, "end": { "line": 4, "column": 64 } }, "extra": { "rawValue": 305, "raw": "305" }, "value": 305 }, { "type": "NumericLiteral", "start": 177, "end": 180, "loc": { "start": { "line": 4, "column": 66 }, "end": { "line": 4, "column": 69 } }, "extra": { "rawValue": 335, "raw": "335" }, "value": 335 } ] } } ], "kind": "const" }, { "type": "FunctionDeclaration", "start": 184, "end": 319, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 9, "column": 1 } }, "id": { "type": "Identifier", "start": 193, "end": 202, "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 18 }, "identifierName": "dayOfWeek" }, "name": "dayOfWeek" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 203, "end": 207, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 6, "column": 23 }, "identifierName": "year" }, "name": "year" }, { "type": "Identifier", "start": 209, "end": 214, "loc": { "start": { "line": 6, "column": 25 }, "end": { "line": 6, "column": 30 }, "identifierName": "month" }, "name": "month" }, { "type": "Identifier", "start": 216, "end": 219, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 6, "column": 35 }, "identifierName": "day" }, "name": "day" } ], "body": { "type": "BlockStatement", "start": 221, "end": 319, "loc": { "start": { "line": 6, "column": 37 }, "end": { "line": 9, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 225, "end": 289, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 66 } }, "declarations": [ { "type": "VariableDeclarator", "start": 231, "end": 288, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 65 } }, "id": { "type": "Identifier", "start": 231, "end": 233, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 10 }, "identifierName": "js" }, "name": "js" }, "init": { "type": "CallExpression", "start": 236, "end": 288, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 65 } }, "callee": { "type": "MemberExpression", "start": 236, "end": 286, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 63 } }, "object": { "type": "NewExpression", "start": 236, "end": 276, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 53 } }, "callee": { "type": "Identifier", "start": 240, "end": 244, "loc": { "start": { "line": 7, "column": 17 }, "end": { "line": 7, "column": 21 }, "identifierName": "Date" }, "name": "Date" }, "arguments": [ { "type": "CallExpression", "start": 245, "end": 275, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 52 } }, "callee": { "type": "MemberExpression", "start": 245, "end": 253, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 30 } }, "object": { "type": "Identifier", "start": 245, "end": 249, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 26 }, "identifierName": "Date" }, "name": "Date" }, "property": { "type": "Identifier", "start": 250, "end": 253, "loc": { "start": { "line": 7, "column": 27 }, "end": { "line": 7, "column": 30 }, "identifierName": "UTC" }, "name": "UTC" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 254, "end": 258, "loc": { "start": { "line": 7, "column": 31 }, "end": { "line": 7, "column": 35 }, "identifierName": "year" }, "name": "year" }, { "type": "BinaryExpression", "start": 260, "end": 269, "loc": { "start": { "line": 7, "column": 37 }, "end": { "line": 7, "column": 46 } }, "left": { "type": "Identifier", "start": 260, "end": 265, "loc": { "start": { "line": 7, "column": 37 }, "end": { "line": 7, "column": 42 }, "identifierName": "month" }, "name": "month" }, "operator": "-", "right": { "type": "NumericLiteral", "start": 268, "end": 269, "loc": { "start": { "line": 7, "column": 45 }, "end": { "line": 7, "column": 46 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } }, { "type": "Identifier", "start": 271, "end": 274, "loc": { "start": { "line": 7, "column": 48 }, "end": { "line": 7, "column": 51 }, "identifierName": "day" }, "name": "day" } ] } ] }, "property": { "type": "Identifier", "start": 277, "end": 286, "loc": { "start": { "line": 7, "column": 54 }, "end": { "line": 7, "column": 63 }, "identifierName": "getUTCDay" }, "name": "getUTCDay" }, "computed": false }, "arguments": [] } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 292, "end": 317, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 27 } }, "argument": { "type": "ConditionalExpression", "start": 299, "end": 316, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 26 } }, "test": { "type": "BinaryExpression", "start": 299, "end": 307, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 17 } }, "left": { "type": "Identifier", "start": 299, "end": 301, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 11 }, "identifierName": "js" }, "name": "js" }, "operator": "===", "right": { "type": "NumericLiteral", "start": 306, "end": 307, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 17 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "consequent": { "type": "NumericLiteral", "start": 310, "end": 311, "loc": { "start": { "line": 8, "column": 20 }, "end": { "line": 8, "column": 21 } }, "extra": { "rawValue": 7, "raw": "7" }, "value": 7 }, "alternate": { "type": "Identifier", "start": 314, "end": 316, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 26 }, "identifierName": "js" }, "name": "js" } } } ], "directives": [] } }, { "type": "FunctionDeclaration", "start": 321, "end": 668, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 330, "end": 344, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 23 }, "identifierName": "lastWeekNumber" }, "name": "lastWeekNumber" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 345, "end": 353, "loc": { "start": { "line": 11, "column": 24 }, "end": { "line": 11, "column": 32 }, "identifierName": "weekYear" }, "name": "weekYear" } ], "body": { "type": "BlockStatement", "start": 355, "end": 668, "loc": { "start": { "line": 11, "column": 34 }, "end": { "line": 21, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 359, "end": 625, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 19, "column": 93 } }, "declarations": [ { "type": "VariableDeclarator", "start": 365, "end": 505, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 17, "column": 7 } }, "id": { "type": "Identifier", "start": 365, "end": 367, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 10 }, "identifierName": "p1" }, "name": "p1" }, "init": { "type": "BinaryExpression", "start": 376, "end": 505, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 17, "column": 7 } }, "left": { "type": "BinaryExpression", "start": 377, "end": 494, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 16, "column": 34 } }, "left": { "type": "BinaryExpression", "start": 377, "end": 457, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 15, "column": 34 } }, "left": { "type": "BinaryExpression", "start": 377, "end": 420, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 14, "column": 32 } }, "left": { "type": "Identifier", "start": 377, "end": 385, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 15 }, "identifierName": "weekYear" }, "name": "weekYear" }, "operator": "+", "right": { "type": "CallExpression", "start": 396, "end": 420, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 396, "end": 406, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 18 } }, "object": { "type": "Identifier", "start": 396, "end": 400, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 }, "identifierName": "Math" }, "name": "Math" }, "property": { "type": "Identifier", "start": 401, "end": 406, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 18 }, "identifierName": "floor" }, "name": "floor" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 407, "end": 419, "loc": { "start": { "line": 14, "column": 19 }, "end": { "line": 14, "column": 31 } }, "left": { "type": "Identifier", "start": 407, "end": 415, "loc": { "start": { "line": 14, "column": 19 }, "end": { "line": 14, "column": 27 }, "identifierName": "weekYear" }, "name": "weekYear" }, "operator": "/", "right": { "type": "NumericLiteral", "start": 418, "end": 419, "loc": { "start": { "line": 14, "column": 30 }, "end": { "line": 14, "column": 31 } }, "extra": { "rawValue": 4, "raw": "4" }, "value": 4 } } ] } }, "operator": "-", "right": { "type": "CallExpression", "start": 431, "end": 457, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 431, "end": 441, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 18 } }, "object": { "type": "Identifier", "start": 431, "end": 435, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 12 }, "identifierName": "Math" }, "name": "Math" }, "property": { "type": "Identifier", "start": 436, "end": 441, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 18 }, "identifierName": "floor" }, "name": "floor" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 442, "end": 456, "loc": { "start": {