luxon
Version:
Immutable date wrapper
1,541 lines (1,540 loc) • 1.53 MB
JSON
{
"type": "File",
"start": 0,
"end": 6909,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 271,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6909,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 271,
"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": "ImportDeclaration",
"start": 31,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 40
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 40,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 40,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "Formatter"
},
"name": "Formatter"
},
"local": {
"type": "Identifier",
"start": 40,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 18
},
"identifierName": "Formatter"
},
"name": "Formatter"
}
}
],
"source": {
"type": "StringLiteral",
"start": 57,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 26
},
"end": {
"line": 2,
"column": 39
}
},
"extra": {
"rawValue": "./formatter",
"raw": "'./formatter'"
},
"value": "./formatter"
}
},
{
"type": "ImportDeclaration",
"start": 72,
"end": 131,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 59
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 81,
"end": 96,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
},
"imported": {
"type": "Identifier",
"start": 81,
"end": 96,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
},
"identifierName": "FixedOffsetZone"
},
"name": "FixedOffsetZone"
},
"local": {
"type": "Identifier",
"start": 81,
"end": 96,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
},
"identifierName": "FixedOffsetZone"
},
"name": "FixedOffsetZone"
}
}
],
"source": {
"type": "StringLiteral",
"start": 104,
"end": 130,
"loc": {
"start": {
"line": 3,
"column": 32
},
"end": {
"line": 3,
"column": 58
}
},
"extra": {
"rawValue": "../zones/fixedOffsetZone",
"raw": "'../zones/fixedOffsetZone'"
},
"value": "../zones/fixedOffsetZone"
}
},
{
"type": "ImportDeclaration",
"start": 132,
"end": 177,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 45
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 141,
"end": 149,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
}
},
"imported": {
"type": "Identifier",
"start": 141,
"end": 149,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "IANAZone"
},
"name": "IANAZone"
},
"local": {
"type": "Identifier",
"start": 141,
"end": 149,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "IANAZone"
},
"name": "IANAZone"
}
}
],
"source": {
"type": "StringLiteral",
"start": 157,
"end": 176,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 44
}
},
"extra": {
"rawValue": "../zones/IANAZone",
"raw": "'../zones/IANAZone'"
},
"value": "../zones/IANAZone"
}
},
{
"type": "VariableDeclaration",
"start": 179,
"end": 251,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 72
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 185,
"end": 250,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 71
}
},
"id": {
"type": "Identifier",
"start": 185,
"end": 196,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 17
},
"identifierName": "MISSING_FTP"
},
"name": "MISSING_FTP"
},
"init": {
"type": "StringLiteral",
"start": 199,
"end": 250,
"loc": {
"start": {
"line": 6,
"column": 20
},
"end": {
"line": 6,
"column": 71
}
},
"extra": {
"rawValue": "missing Intl.DateTimeFormat.formatToParts support",
"raw": "'missing Intl.DateTimeFormat.formatToParts support'"
},
"value": "missing Intl.DateTimeFormat.formatToParts support"
}
}
],
"kind": "const"
},
{
"type": "FunctionDeclaration",
"start": 253,
"end": 354,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 10,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 262,
"end": 269,
"loc": {
"start": {
"line": 8,
"column": 9
},
"end": {
"line": 8,
"column": 16
},
"identifierName": "intUnit"
},
"name": "intUnit"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 270,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 17
},
"end": {
"line": 8,
"column": 22
},
"identifierName": "regex"
},
"name": "regex"
},
{
"type": "AssignmentPattern",
"start": 277,
"end": 290,
"loc": {
"start": {
"line": 8,
"column": 24
},
"end": {
"line": 8,
"column": 37
}
},
"left": {
"type": "Identifier",
"start": 277,
"end": 281,
"loc": {
"start": {
"line": 8,
"column": 24
},
"end": {
"line": 8,
"column": 28
},
"identifierName": "post"
},
"name": "post"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 284,
"end": 290,
"loc": {
"start": {
"line": 8,
"column": 31
},
"end": {
"line": 8,
"column": 37
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 284,
"end": 285,
"loc": {
"start": {
"line": 8,
"column": 31
},
"end": {
"line": 8,
"column": 32
},
"identifierName": "i"
},
"name": "i"
}
],
"body": {
"type": "Identifier",
"start": 289,
"end": 290,
"loc": {
"start": {
"line": 8,
"column": 36
},
"end": {
"line": 8,
"column": 37
},
"identifierName": "i"
},
"name": "i"
}
}
}
],
"body": {
"type": "BlockStatement",
"start": 292,
"end": 354,
"loc": {
"start": {
"line": 8,
"column": 39
},
"end": {
"line": 10,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 296,
"end": 352,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 58
}
},
"argument": {
"type": "ObjectExpression",
"start": 303,
"end": 351,
"loc": {
"start": {
"line": 9,
"column": 9
},
"end": {
"line": 9,
"column": 57
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 305,
"end": 310,
"loc": {
"start": {
"line": 9,
"column": 11
},
"end": {
"line": 9,
"column": 16
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 305,
"end": 310,
"loc": {
"start": {
"line": 9,
"column": 11
},
"end": {
"line": 9,
"column": 16
},
"identifierName": "regex"
},
"name": "regex"
},
"value": {
"type": "Identifier",
"start": 305,
"end": 310,
"loc": {
"start": {
"line": 9,
"column": 11
},
"end": {
"line": 9,
"column": 16
},
"identifierName": "regex"
},
"name": "regex"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 312,
"end": 349,
"loc": {
"start": {
"line": 9,
"column": 18
},
"end": {
"line": 9,
"column": 55
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 312,
"end": 317,
"loc": {
"start": {
"line": 9,
"column": 18
},
"end": {
"line": 9,
"column": 23
},
"identifierName": "deser"
},
"name": "deser"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 319,
"end": 349,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 9,
"column": 55
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "ArrayPattern",
"start": 320,
"end": 323,
"loc": {
"start": {
"line": 9,
"column": 26
},
"end": {
"line": 9,
"column": 29
}
},
"elements": [
{
"type": "Identifier",
"start": 321,
"end": 322,
"loc": {
"start": {
"line": 9,
"column": 27
},
"end": {
"line": 9,
"column": 28
},
"identifierName": "s"
},
"name": "s"
}
]
}
],
"body": {
"type": "CallExpression",
"start": 328,
"end": 349,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 9,
"column": 55
}
},
"callee": {
"type": "Identifier",
"start": 328,
"end": 332,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 9,
"column": 38
},
"identifierName": "post"
},
"name": "post"
},
"arguments": [
{
"type": "CallExpression",
"start": 333,
"end": 348,
"loc": {
"start": {
"line": 9,
"column": 39
},
"end": {
"line": 9,
"column": 54
}
},
"callee": {
"type": "Identifier",
"start": 333,
"end": 341,
"loc": {
"start": {
"line": 9,
"column": 39
},
"end": {
"line": 9,
"column": 47
},
"identifierName": "parseInt"
},
"name": "parseInt"
},
"arguments": [
{
"type": "Identifier",
"start": 342,
"end": 343,
"loc": {
"start": {
"line": 9,
"column": 48
},
"end": {
"line": 9,
"column": 49
},
"identifierName": "s"
},
"name": "s"
},
{
"type": "NumericLiteral",
"start": 345,
"end": 347,
"loc": {
"start": {
"line": 9,
"column": 51
},
"end": {
"line": 9,
"column": 53
}
},
"extra": {
"rawValue": 10,
"raw": "10"
},
"value": 10
}
]
}
]
}
}
}
]
}
}
],
"directives": []
}
},
{
"type": "FunctionDeclaration",
"start": 356,
"end": 608,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 21,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 365,
"end": 370,
"loc": {
"start": {
"line": 12,
"column": 9
},
"end": {
"line": 12,
"column": 14
},
"identifierName": "oneOf"
},
"name": "oneOf"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 371,
"end": 378,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 12,
"column": 22
},
"identifierName": "strings"
},
"name": "strings"
},
{
"type": "Identifier",
"start": 380,
"end": 390,
"loc": {
"start": {
"line": 12,
"column": 24
},
"end": {
"line": 12,
"column": 34
},
"identifierName": "startIndex"
},
"name": "startIndex"
}
],
"body": {
"type": "BlockStatement",
"start": 392,
"end": 608,
"loc": {
"start": {
"line": 12,
"column": 36
},
"end": {
"line": 21,
"column": 1
}
},
"body": [
{
"type": "IfStatement",
"start": 396,
"end": 606,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"test": {
"type": "BinaryExpression",
"start": 400,
"end": 416,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 22
}
},
"left": {
"type": "Identifier",
"start": 400,
"end": 407,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 13
},
"identifierName": "strings"
},
"name": "strings"
},
"operator": "===",
"right": {
"type": "NullLiteral",
"start": 412,
"end": 416,
"loc": {
"start": {
"line": 13,
"column": 18
},
"end": {
"line": 13,
"column": 22
}
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 418,
"end": 440,
"loc": {
"start": {
"line": 13,
"column": 24
},
"end": {
"line": 15,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 424,
"end": 436,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 16
}
},
"argument": {
"type": "NullLiteral",
"start": 431,
"end": 435,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 15
}
}
}
}
],
"directives": []
},
"alternate": {
"type": "BlockStatement",
"start": 446,
"end": 606,
"loc": {
"start": {
"line": 15,
"column": 9
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 452,
"end": 602,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 19,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 459,
"end": 601,
"loc": {
"start": {
"line": 16,
"column": 11
},
"end": {
"line": 19,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 467,
"end": 499,
"loc": {
"start": {
"line": 17,
"column": 6
},
"end": {
"line": 17,
"column": 38
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 467,
"end": 472,
"loc": {
"start": {
"line": 17,
"column": 6
},
"end": {
"line": 17,
"column": 11
},
"identifierName": "regex"
},
"name": "regex"
},
"value": {
"type": "CallExpression",
"start": 474,
"end": 499,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 38
}
},
"callee": {
"type": "Identifier",
"start": 474,
"end": 480,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 19
},
"identifierName": "RegExp"
},
"name": "RegExp"
},
"arguments": [
{
"type": "CallExpression",
"start": 481,
"end": 498,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 37
}
},
"callee": {
"type": "MemberExpression",
"start": 481,
"end": 493,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 481,
"end": 488,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 27
},
"identifierName": "strings"
},
"name": "strings"
},
"property": {
"type": "Identifier",
"start": 489,
"end": 493,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 32
},
"identifierName": "join"
},
"name": "join"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 494,
"end": 497,
"loc": {
"start": {
"line": 17,
"column": 33
},
"end": {
"line": 17,
"column": 36
}
},
"extra": {
"rawValue": "|",
"raw": "'|'"
},
"value": "|"
}
]
}
]
}
},
{
"type": "ObjectProperty",
"start": 507,
"end": 595,
"loc": {
"start": {
"line": 18,
"column": 6
},
"end": {
"line": 18,
"column": 94
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 507,
"end": 512,
"loc": {
"start": {
"line": 18,
"column": 6
},
"end": {
"line": 18,
"column": 11
},
"identifierName": "deser"
},
"name": "deser"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 514,
"end": 595,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 94
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "ArrayPattern",
"start": 515,
"end": 518,
"loc": {
"start": {
"line": 18,
"column": 14
},
"end": {
"line": 18,
"column": 17
}
},
"elements": [
{
"type": "Identifier",
"start": 516,
"end": 517,
"loc": {
"start": {
"line": 18,
"column": 15
},
"end": {
"line": 18,
"column": 16
},
"identifierName": "s"
},
"name": "s"
}
]
}
],
"body": {
"type": "BinaryExpression",
"start": 523,
"end": 595,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 94
}
},
"left": {
"type": "CallExpression",
"start": 523,
"end": 582,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 81
}
},
"callee": {
"type": "MemberExpression",
"start": 523,
"end": 540,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 523,
"end": 530,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 29
},
"identifierName": "strings"
},
"name": "strings"
},
"property": {
"type": "Identifier",
"start": 531,
"end": 540,
"loc": {
"start": {
"line": 18,
"column": 30
},
"end": {
"line": 18,
"column": 39
},
"identifierName": "findIndex"
},
"name": "findIndex"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 541,
"end": 581,
"loc": {
"start": {
"line": 18,
"column": 40
},
"end": {
"line": 18,
"column": 80
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 541,
"end": 542,
"loc": {
"start": {
"line": 18,
"column": 40
},
"end": {
"line": 18,
"column": 41
},
"identifierName": "i"
},
"name": "i"
}
],
"body": {
"type": "BinaryExpression",
"start": 546,
"end": 581,
"loc": {
"start": {
"line": 18,
"column": 45
},
"end": {
"line": 18,
"column": 80
}
},
"left": {
"type": "CallExpression",
"start": 546,
"end": 561,
"loc": {
"start": {
"line": 18,
"column": 45
},
"end": {
"line": 18,
"column": 60
}
},
"callee": {
"type": "MemberExpression",
"start": 546,
"end": 559,
"loc": {
"start": {
"line": 18,
"column": 45
},
"end": {
"line": 18,
"column": 58
}
},
"object": {
"type": "Identifier",
"start": 546,
"end": 547,
"loc": {
"start": {
"line": 18,
"column": 45
},
"end": {
"line": 18,
"column": 46
},
"identifierName": "s"