luxon
Version:
Immutable date wrapper
1,441 lines (1,440 loc) • 1.86 MB
JSON
{
"type": "File",
"start": 0,
"end": 8556,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 314,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 8556,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 314,
"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": 67,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 36
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 40,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 40,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 16
},
"identifierName": "English"
},
"name": "English"
},
"local": {
"type": "Identifier",
"start": 40,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 16
},
"identifierName": "English"
},
"name": "English"
}
}
],
"source": {
"type": "StringLiteral",
"start": 55,
"end": 66,
"loc": {
"start": {
"line": 2,
"column": 24
},
"end": {
"line": 2,
"column": 35
}
},
"extra": {
"rawValue": "./english",
"raw": "'./english'"
},
"value": "./english"
}
},
{
"type": "ImportDeclaration",
"start": 68,
"end": 107,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 39
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 77,
"end": 85,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 17
}
},
"imported": {
"type": "Identifier",
"start": 77,
"end": 85,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 17
},
"identifierName": "DateTime"
},
"name": "DateTime"
},
"local": {
"type": "Identifier",
"start": 77,
"end": 85,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 17
},
"identifierName": "DateTime"
},
"name": "DateTime"
}
}
],
"source": {
"type": "StringLiteral",
"start": 93,
"end": 106,
"loc": {
"start": {
"line": 3,
"column": 25
},
"end": {
"line": 3,
"column": 38
}
},
"extra": {
"rawValue": "../datetime",
"raw": "'../datetime'"
},
"value": "../datetime"
}
},
{
"type": "VariableDeclaration",
"start": 109,
"end": 132,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 23
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 115,
"end": 131,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 22
}
},
"id": {
"type": "Identifier",
"start": 115,
"end": 126,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 17
},
"identifierName": "localeCache"
},
"name": "localeCache"
},
"init": {
"type": "ObjectExpression",
"start": 129,
"end": 131,
"loc": {
"start": {
"line": 5,
"column": 20
},
"end": {
"line": 5,
"column": 22
}
},
"properties": []
}
}
],
"kind": "const"
},
{
"type": "FunctionDeclaration",
"start": 134,
"end": 609,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 26,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 143,
"end": 159,
"loc": {
"start": {
"line": 7,
"column": 9
},
"end": {
"line": 7,
"column": 25
},
"identifierName": "intlConfigString"
},
"name": "intlConfigString"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 160,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 26
},
"end": {
"line": 7,
"column": 32
},
"identifierName": "locale"
},
"name": "locale"
},
{
"type": "Identifier",
"start": 168,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 34
},
"end": {
"line": 7,
"column": 49
},
"identifierName": "numberingSystem"
},
"name": "numberingSystem"
},
{
"type": "Identifier",
"start": 185,
"end": 199,
"loc": {
"start": {
"line": 7,
"column": 51
},
"end": {
"line": 7,
"column": 65
},
"identifierName": "outputCalendar"
},
"name": "outputCalendar"
}
],
"body": {
"type": "BlockStatement",
"start": 201,
"end": 609,
"loc": {
"start": {
"line": 7,
"column": 67
},
"end": {
"line": 26,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 205,
"end": 276,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 73
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 209,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 72
}
},
"id": {
"type": "Identifier",
"start": 209,
"end": 212,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 9
},
"identifierName": "loc"
},
"name": "loc"
},
"init": {
"type": "LogicalExpression",
"start": 215,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 12
},
"end": {
"line": 8,
"column": 72
}
},
"left": {
"type": "Identifier",
"start": 215,
"end": 221,
"loc": {
"start": {
"line": 8,
"column": 12
},
"end": {
"line": 8,
"column": 18
},
"identifierName": "locale"
},
"name": "locale"
},
"operator": "||",
"right": {
"type": "MemberExpression",
"start": 225,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 22
},
"end": {
"line": 8,
"column": 72
}
},
"object": {
"type": "CallExpression",
"start": 225,
"end": 268,
"loc": {
"start": {
"line": 8,
"column": 22
},
"end": {
"line": 8,
"column": 65
}
},
"callee": {
"type": "MemberExpression",
"start": 225,
"end": 266,
"loc": {
"start": {
"line": 8,
"column": 22
},
"end": {
"line": 8,
"column": 63
}
},
"object": {
"type": "NewExpression",
"start": 225,
"end": 250,
"loc": {
"start": {
"line": 8,
"column": 22
},
"end": {
"line": 8,
"column": 47
}
},
"callee": {
"type": "MemberExpression",
"start": 229,
"end": 248,
"loc": {
"start": {
"line": 8,
"column": 26
},
"end": {
"line": 8,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 229,
"end": 233,
"loc": {
"start": {
"line": 8,
"column": 26
},
"end": {
"line": 8,
"column": 30
},
"identifierName": "Intl"
},
"name": "Intl"
},
"property": {
"type": "Identifier",
"start": 234,
"end": 248,
"loc": {
"start": {
"line": 8,
"column": 31
},
"end": {
"line": 8,
"column": 45
},
"identifierName": "DateTimeFormat"
},
"name": "DateTimeFormat"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 251,
"end": 266,
"loc": {
"start": {
"line": 8,
"column": 48
},
"end": {
"line": 8,
"column": 63
},
"identifierName": "resolvedOptions"
},
"name": "resolvedOptions"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 269,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 66
},
"end": {
"line": 8,
"column": 72
},
"identifierName": "locale"
},
"name": "locale"
},
"computed": false
}
}
}
],
"kind": "let"
},
{
"type": "ExpressionStatement",
"start": 279,
"end": 327,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 50
}
},
"expression": {
"type": "AssignmentExpression",
"start": 279,
"end": 326,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 49
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 279,
"end": 282,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 5
},
"identifierName": "loc"
},
"name": "loc"
},
"right": {
"type": "ConditionalExpression",
"start": 285,
"end": 326,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 49
}
},
"test": {
"type": "CallExpression",
"start": 285,
"end": 306,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 29
}
},
"callee": {
"type": "MemberExpression",
"start": 285,
"end": 298,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 21
}
},
"object": {
"type": "Identifier",
"start": 285,
"end": 290,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 13
},
"identifierName": "Array"
},
"name": "Array"
},
"property": {
"type": "Identifier",
"start": 291,
"end": 298,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 21
},
"identifierName": "isArray"
},
"name": "isArray"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 299,
"end": 305,
"loc": {
"start": {
"line": 9,
"column": 22
},
"end": {
"line": 9,
"column": 28
},
"identifierName": "locale"
},
"name": "locale"
}
]
},
"consequent": {
"type": "Identifier",
"start": 309,
"end": 315,
"loc": {
"start": {
"line": 9,
"column": 32
},
"end": {
"line": 9,
"column": 38
},
"identifierName": "locale"
},
"name": "locale"
},
"alternate": {
"type": "ArrayExpression",
"start": 318,
"end": 326,
"loc": {
"start": {
"line": 9,
"column": 41
},
"end": {
"line": 9,
"column": 49
}
},
"elements": [
{
"type": "Identifier",
"start": 319,
"end": 325,
"loc": {
"start": {
"line": 9,
"column": 42
},
"end": {
"line": 9,
"column": 48
},
"identifierName": "locale"
},
"name": "locale"
}
]
}
}
}
},
{
"type": "IfStatement",
"start": 331,
"end": 593,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 24,
"column": 3
}
},
"test": {
"type": "LogicalExpression",
"start": 335,
"end": 368,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 335,
"end": 349,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 20
},
"identifierName": "outputCalendar"
},
"name": "outputCalendar"
},
"operator": "||",
"right": {
"type": "Identifier",
"start": 353,
"end": 368,
"loc": {
"start": {
"line": 11,
"column": 24
},
"end": {
"line": 11,
"column": 39
},
"identifierName": "numberingSystem"
},
"name": "numberingSystem"
}
},
"consequent": {
"type": "BlockStatement",
"start": 370,
"end": 593,
"loc": {
"start": {
"line": 11,
"column": 41
},
"end": {
"line": 24,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 376,
"end": 589,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 23,
"column": 7
}
},
"expression": {
"type": "AssignmentExpression",
"start": 376,
"end": 588,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 23,
"column": 6
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 376,
"end": 379,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 7
},
"identifierName": "loc"
},
"name": "loc"
},
"right": {
"type": "CallExpression",
"start": 382,
"end": 588,
"loc": {
"start": {
"line": 12,
"column": 10
},
"end": {
"line": 23,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 382,
"end": 389,
"loc": {
"start": {
"line": 12,
"column": 10
},
"end": {
"line": 12,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 382,
"end": 385,
"loc": {
"start": {
"line": 12,
"column": 10
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "loc"
},
"name": "loc"
},
"property": {
"type": "Identifier",
"start": 386,
"end": 389,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 17
},
"identifierName": "map"
},
"name": "map"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 390,
"end": 587,
"loc": {
"start": {
"line": 12,
"column": 18
},
"end": {
"line": 23,
"column": 5
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 390,
"end": 391,
"loc": {
"start": {
"line": 12,
"column": 18
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "l"
},
"name": "l"
}
],
"body": {
"type": "BlockStatement",
"start": 395,
"end": 587,
"loc": {
"start": {
"line": 12,
"column": 23
},
"end": {
"line": 23,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 403,
"end": 413,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 16
}
},
"expression": {
"type": "AssignmentExpression",
"start": 403,
"end": 412,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 15
}
},
"operator": "+=",
"left": {
"type": "Identifier",
"start": 403,
"end": 404,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 7
},
"identifierName": "l"
},
"name": "l"
},
"right": {
"type": "StringLiteral",
"start": 408,
"end": 412,
"loc": {
"start": {
"line": 13,
"column": 11
},
"end": {
"line": 13,
"column": 15
}
},
"extra": {
"rawValue": "-u",
"raw": "'-u'"
},
"value": "-u"
}
}
},
{
"type": "IfStatement",
"start": 421,
"end": 488,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 17,
"column": 7
}
},
"test": {
"type": "Identifier",
"start": 425,
"end": 439,
"loc": {
"start": {
"line": 15,
"column": 10
},
"end": {
"line": 15,
"column": 24
},
"identifierName": "outputCalendar"
},
"name": "outputCalendar"
},
"consequent": {
"type": "BlockStatement",
"start": 441,
"end": 488,
"loc": {
"start": {
"line": 15,
"column": 26
},
"end": {
"line": 17,
"column": 7
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 451,
"end": 480,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 451,
"end": 479,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 36
}
},
"operator": "+=",
"left": {
"type": "Identifier",
"start": 451,
"end": 452,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 9
},
"identifierName": "l"
},
"name": "l"
},
"right": {
"type": "BinaryExpression",
"start": 456,
"end": 479,
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 36
}
},
"left": {
"type": "StringLiteral",
"start": 456,
"end": 462,
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 19
}
},
"extra": {
"rawValue": "-ca-",
"raw": "'-ca-'"
},
"value": "-ca-"
},
"operator": "+",
"right": {
"type": "Identifier",
"start": 465,
"end": 479,
"loc": {
"start": {
"line": 16,
"column": 22
},
"end": {
"line": 16,
"column": 36
},
"identifierName": "outputCalendar"
},
"name": "outputCalendar"
}
}
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "IfStatement",
"start": 496,
"end": 565,
"loc": {
"start": {
"line": 19,
"column": 6
},
"end": {
"line": 21,
"column": 7
}
},
"test": {
"type": "Identifier",
"start": 500,
"end": 515,
"loc": {
"start": {
"line": 19,
"column": 10
},
"end": {
"line": 19,
"column": 25
},
"identifierName": "numberingSystem"
},
"name": "numberingSystem"
},
"consequent": {
"type": "BlockStatement",
"start": 517,
"end": 565,
"loc": {
"start": {
"line": 19,
"column": 27
},
"end": {
"line": 21,
"column": 7
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 527,
"end": 557,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 38
}
},
"expression": {
"type": "AssignmentExpression",
"start": 527,
"end": 556,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 37
}
},
"operator": "+=",
"left": {
"type": "Identifier",
"start": 527,
"end": 528,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 9
},
"identifierName": "l"
},
"name": "l"
},
"right": {