luxon
Version:
Immutable date wrapper
1,694 lines (1,693 loc) • 502 kB
JSON
{
"type": "File",
"start": 0,
"end": 2196,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 103,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2196,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 103,
"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": 161,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 11,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 76,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 11,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 76,
"end": 85,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 15
},
"identifierName": "typeToPos"
},
"name": "typeToPos"
},
"init": {
"type": "ObjectExpression",
"start": 88,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 11,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 92,
"end": 99,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 9
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 92,
"end": 96,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 6
},
"identifierName": "year"
},
"name": "year"
},
"value": {
"type": "NumericLiteral",
"start": 98,
"end": 99,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 9
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "ObjectProperty",
"start": 103,
"end": 111,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 10
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 103,
"end": 108,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 7
},
"identifierName": "month"
},
"name": "month"
},
"value": {
"type": "NumericLiteral",
"start": 110,
"end": 111,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 10
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
},
{
"type": "ObjectProperty",
"start": 115,
"end": 121,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 8
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 115,
"end": 118,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 5
},
"identifierName": "day"
},
"name": "day"
},
"value": {
"type": "NumericLiteral",
"start": 120,
"end": 121,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 8
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
},
{
"type": "ObjectProperty",
"start": 125,
"end": 132,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 9
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 125,
"end": 129,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 6
},
"identifierName": "hour"
},
"name": "hour"
},
"value": {
"type": "NumericLiteral",
"start": 131,
"end": 132,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 9
}
},
"extra": {
"rawValue": 3,
"raw": "3"
},
"value": 3
}
},
{
"type": "ObjectProperty",
"start": 136,
"end": 145,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 11
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 136,
"end": 142,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 8
},
"identifierName": "minute"
},
"name": "minute"
},
"value": {
"type": "NumericLiteral",
"start": 144,
"end": 145,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 11
}
},
"extra": {
"rawValue": 4,
"raw": "4"
},
"value": 4
}
},
{
"type": "ObjectProperty",
"start": 149,
"end": 158,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 11
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 149,
"end": 155,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 8
},
"identifierName": "second"
},
"name": "second"
},
"value": {
"type": "NumericLiteral",
"start": 157,
"end": 158,
"loc": {
"start": {
"line": 10,
"column": 10
},
"end": {
"line": 10,
"column": 11
}
},
"extra": {
"rawValue": 5,
"raw": "5"
},
"value": 5
}
}
]
}
}
],
"kind": "const"
},
{
"type": "FunctionDeclaration",
"start": 163,
"end": 427,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 18,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 172,
"end": 183,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 20
},
"identifierName": "hackyOffset"
},
"name": "hackyOffset"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 184,
"end": 187,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 24
},
"identifierName": "dtf"
},
"name": "dtf"
},
{
"type": "Identifier",
"start": 189,
"end": 193,
"loc": {
"start": {
"line": 13,
"column": 26
},
"end": {
"line": 13,
"column": 30
},
"identifierName": "date"
},
"name": "date"
}
],
"body": {
"type": "BlockStatement",
"start": 195,
"end": 427,
"loc": {
"start": {
"line": 13,
"column": 32
},
"end": {
"line": 18,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 199,
"end": 368,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 16,
"column": 62
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 205,
"end": 233,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 205,
"end": 214,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 17
},
"identifierName": "formatted"
},
"name": "formatted"
},
"init": {
"type": "CallExpression",
"start": 217,
"end": 233,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 217,
"end": 227,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 217,
"end": 220,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 23
},
"identifierName": "dtf"
},
"name": "dtf"
},
"property": {
"type": "Identifier",
"start": 221,
"end": 227,
"loc": {
"start": {
"line": 14,
"column": 24
},
"end": {
"line": 14,
"column": 30
},
"identifierName": "format"
},
"name": "format"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 228,
"end": 232,
"loc": {
"start": {
"line": 14,
"column": 31
},
"end": {
"line": 14,
"column": 35
},
"identifierName": "date"
},
"name": "date"
}
]
}
},
{
"type": "VariableDeclarator",
"start": 239,
"end": 304,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 69
}
},
"id": {
"type": "Identifier",
"start": 239,
"end": 245,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 10
},
"identifierName": "parsed"
},
"name": "parsed"
},
"init": {
"type": "CallExpression",
"start": 248,
"end": 304,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 69
}
},
"callee": {
"type": "MemberExpression",
"start": 248,
"end": 293,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 58
}
},
"object": {
"type": "RegExpLiteral",
"start": 248,
"end": 288,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 53
}
},
"extra": {
"raw": "/(\\d+)\\/(\\d+)\\/(\\d+), (\\d+):(\\d+):(\\d+)/"
},
"pattern": "(\\d+)\\/(\\d+)\\/(\\d+), (\\d+):(\\d+):(\\d+)",
"flags": ""
},
"property": {
"type": "Identifier",
"start": 289,
"end": 293,
"loc": {
"start": {
"line": 15,
"column": 54
},
"end": {
"line": 15,
"column": 58
},
"identifierName": "exec"
},
"name": "exec"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 294,
"end": 303,
"loc": {
"start": {
"line": 15,
"column": 59
},
"end": {
"line": 15,
"column": 68
},
"identifierName": "formatted"
},
"name": "formatted"
}
]
}
},
{
"type": "VariableDeclarator",
"start": 310,
"end": 367,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 61
}
},
"id": {
"type": "ArrayPattern",
"start": 310,
"end": 358,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 52
}
},
"elements": [
null,
{
"type": "Identifier",
"start": 313,
"end": 319,
"loc": {
"start": {
"line": 16,
"column": 7
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "fMonth"
},
"name": "fMonth"
},
{
"type": "Identifier",
"start": 321,
"end": 325,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 16,
"column": 19
},
"identifierName": "fDay"
},
"name": "fDay"
},
{
"type": "Identifier",
"start": 327,
"end": 332,
"loc": {
"start": {
"line": 16,
"column": 21
},
"end": {
"line": 16,
"column": 26
},
"identifierName": "fYear"
},
"name": "fYear"
},
{
"type": "Identifier",
"start": 334,
"end": 339,
"loc": {
"start": {
"line": 16,
"column": 28
},
"end": {
"line": 16,
"column": 33
},
"identifierName": "fHour"
},
"name": "fHour"
},
{
"type": "Identifier",
"start": 341,
"end": 348,
"loc": {
"start": {
"line": 16,
"column": 35
},
"end": {
"line": 16,
"column": 42
},
"identifierName": "fMinute"
},
"name": "fMinute"
},
{
"type": "Identifier",
"start": 350,
"end": 357,
"loc": {
"start": {
"line": 16,
"column": 44
},
"end": {
"line": 16,
"column": 51
},
"identifierName": "fSecond"
},
"name": "fSecond"
}
]
},
"init": {
"type": "Identifier",
"start": 361,
"end": 367,
"loc": {
"start": {
"line": 16,
"column": 55
},
"end": {
"line": 16,
"column": 61
},
"identifierName": "parsed"
},
"name": "parsed"
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 371,
"end": 425,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 56
}
},
"argument": {
"type": "ArrayExpression",
"start": 378,
"end": 424,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 55
}
},
"elements": [
{
"type": "Identifier",
"start": 379,
"end": 384,
"loc": {
"start": {
"line": 17,
"column": 10
},
"end": {
"line": 17,
"column": 15
},
"identifierName": "fYear"
},
"name": "fYear"
},
{
"type": "Identifier",
"start": 386,
"end": 392,
"loc": {
"start": {
"line": 17,
"column": 17
},
"end": {
"line": 17,
"column": 23
},
"identifierName": "fMonth"
},
"name": "fMonth"
},
{
"type": "Identifier",
"start": 394,
"end": 398,
"loc": {
"start": {
"line": 17,
"column": 25
},
"end": {
"line": 17,
"column": 29
},
"identifierName": "fDay"
},
"name": "fDay"
},
{
"type": "Identifier",
"start": 400,
"end": 405,
"loc": {
"start": {
"line": 17,
"column": 31
},
"end": {
"line": 17,
"column": 36
},
"identifierName": "fHour"
},
"name": "fHour"
},
{
"type": "Identifier",
"start": 407,
"end": 414,
"loc": {
"start": {
"line": 17,
"column": 38
},
"end": {
"line": 17,
"column": 45
},
"identifierName": "fMinute"
},
"name": "fMinute"
},
{
"type": "Identifier",
"start": 416,
"end": 423,
"loc": {
"start": {
"line": 17,
"column": 47
},
"end": {
"line": 17,
"column": 54
},
"identifierName": "fSecond"
},
"name": "fSecond"
}
]
}
}
],
"directives": []
}
},
{
"type": "FunctionDeclaration",
"start": 429,
"end": 747,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 32,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 438,
"end": 449,
"loc": {
"start": {
"line": 20,
"column": 9
},
"end": {
"line": 20,
"column": 20
},
"identifierName": "partsOffset"
},
"name": "partsOffset"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 450,
"end": 453,
"loc": {
"start": {
"line": 20,
"column": 21
},
"end": {
"line": 20,
"column": 24
},
"identifierName": "dtf"
},
"name": "dtf"
},
{
"type": "Identifier",
"start": 455,
"end": 459,
"loc": {
"start": {
"line": 20,
"column": 26
},
"end": {
"line": 20,
"column": 30
},
"identifierName": "date"
},
"name": "date"
}
],
"body": {
"type": "BlockStatement",
"start": 461,
"end": 747,
"loc": {
"start": {
"line": 20,
"column": 32
},
"end": {
"line": 32,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 465,
"end": 524,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 22,
"column": 16
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 471,
"end": 506,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 43
}
},
"id": {
"type": "Identifier",
"start": 471,
"end": 480,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 17
},
"identifierName": "formatted"
},
"name": "formatted"
},
"init": {
"type": "CallExpression",
"start": 483,
"end": 506,
"loc": {
"start": {
"line": 21,
"column": 20
},
"end": {
"line": 21,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 483,
"end": 500,
"loc": {
"start": {
"line": 21,
"column": 20
},
"end": {
"line": 21,
"column": 37
}
},
"object": {
"type": "Identifier",
"start": 483,
"end": 486,
"loc": {
"start": {
"line": 21,
"column": 20
},
"end": {
"line": 21,
"column": 23
},
"identifierName": "dtf"
},
"name": "dtf"
},
"property": {
"type": "Identifier",
"start": 487,
"end": 500,
"loc": {
"start": {
"line": 21,
"column": 24
},
"end": {
"line": 21,
"column": 37
},
"identifierName": "formatToParts"
},
"name": "formatToParts"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 501,
"end": 505,
"loc": {
"start": {
"line": 21,
"column": 38
},
"end": {
"line": 21,
"column": 42
},
"identifierName": "date"
},
"name": "date"
}
]
}
},
{
"type": "VariableDeclarator",
"start": 512,
"end": 523,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 15
}
},
"id": {
"type": "Identifier",
"start": 512,
"end": 518,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 10
},
"identifierName": "filled"
},
"name": "filled"
},
"init": {
"type": "ArrayExpression",
"start": 521,
"end": 523,
"loc": {
"start": {
"line": 22,
"column": 13
},
"end": {
"line": 22,
"column": 15
}
},
"elements": []
}
}
],
"kind": "const"
},
{
"type": "ForStatement",
"start": 527,
"end": 728,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 30,
"column": 3
}
},
"init": {
"type": "VariableDeclaration",
"start": 532,
"end": 541,
"loc": {
"start": {
"line": 23,
"column": 7
},
"end": {
"line": 23,
"column": 16
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 536,
"end": 541,
"loc": {
"start": {
"line": 23,
"column": 11
},
"end": {
"line": 23,
"column": 16
}
},
"id": {
"type": "Identifier",
"start": 536,
"end": 537,
"loc": {
"start": {
"line": 23,
"column": 11
},
"end": {
"line": 23,
"column": 12
},
"identifierName": "i"
},
"name": "i"
},
"init": {
"type": "NumericLiteral",
"start": 540,
"end": 541,
"loc": {
"start": {
"line": 23,
"column": 15
},
"end": {
"line": 23,
"column": 16
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
],
"kind": "let"
},
"test": {
"type": "BinaryExpression",
"start": 543,
"end": 563,
"loc": {
"start": {
"line": 23,
"column": 18
},
"end": {
"line": 23,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 543,
"end": 544,
"loc": {
"start": {
"line": 23,
"column": 18
},
"end": {
"line": 23,
"column": 19
},
"identifierName": "i"
},
"name": "i"
},
"operator": "<",
"right": {
"type": "MemberExpression",
"start": 547,
"end": 563,
"loc": {
"start": {
"line": 23,
"column": 22
},
"end": {
"line": 23,
"column": 38
}
},
"object": {
"type": "Identifier",
"start": 547,
"end": 556,
"loc": {
"start": {
"line": 23,
"column": 22
},
"end": {
"line": 23,
"column": 31
},
"identifierName": "formatted"
},
"name": "formatted"
},
"property": {
"type": "Identifier",
"start": 557,
"end": 563,
"loc": {
"start": {
"line": 23,
"column": 32
},
"end": {
"line": 23,
"column": 38
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
}
},
"update": {
"type": "UpdateExpression",
"start": 565,
"end": 568,
"loc": {
"start": {
"line": 23,
"column": 40
},
"end": {
"line": 23,
"column": 43
}
},
"operator": "++",
"prefix": false,
"argument": {
"type": "Identifier",
"start": 565,
"end": 566,
"loc": {
"start": {
"line": 23,
"column": 40
},
"end": {
"line": 23,
"column": 41
},
"identifierName": "i"
},
"name": "i"