luxon
Version:
Immutable date wrapper
1,472 lines (1,471 loc) • 176 kB
JSON
{
"type": "File",
"start": 0,
"end": 851,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 48,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 851,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 48,
"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": 91,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 21
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 74,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 20
}
},
"id": {
"type": "Identifier",
"start": 74,
"end": 83,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 13
},
"identifierName": "singleton"
},
"name": "singleton"
},
"init": {
"type": "NullLiteral",
"start": 86,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 20
}
}
}
}
],
"kind": "let",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @private\n ",
"start": 93,
"end": 112,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 114,
"end": 850,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 47,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "ClassDeclaration",
"start": 121,
"end": 850,
"loc": {
"start": {
"line": 10,
"column": 7
},
"end": {
"line": 47,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 127,
"end": 136,
"loc": {
"start": {
"line": 10,
"column": 13
},
"end": {
"line": 10,
"column": 22
},
"identifierName": "LocalZone"
},
"name": "LocalZone",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 145,
"end": 149,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 35
},
"identifierName": "Zone"
},
"name": "Zone"
},
"body": {
"type": "ClassBody",
"start": 150,
"end": 850,
"loc": {
"start": {
"line": 10,
"column": 36
},
"end": {
"line": 47,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 154,
"end": 274,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 16,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 165,
"end": 173,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 21
},
"identifierName": "instance"
},
"name": "instance"
},
"static": true,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 176,
"end": 274,
"loc": {
"start": {
"line": 11,
"column": 24
},
"end": {
"line": 16,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 182,
"end": 248,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 14,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 186,
"end": 204,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 26
}
},
"left": {
"type": "Identifier",
"start": 186,
"end": 195,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 17
},
"identifierName": "singleton"
},
"name": "singleton"
},
"operator": "===",
"right": {
"type": "NullLiteral",
"start": 200,
"end": 204,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 26
}
}
}
},
"consequent": {
"type": "BlockStatement",
"start": 206,
"end": 248,
"loc": {
"start": {
"line": 12,
"column": 28
},
"end": {
"line": 14,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 214,
"end": 242,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 214,
"end": 241,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 33
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 214,
"end": 223,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 15
},
"identifierName": "singleton"
},
"name": "singleton"
},
"right": {
"type": "NewExpression",
"start": 226,
"end": 241,
"loc": {
"start": {
"line": 13,
"column": 18
},
"end": {
"line": 13,
"column": 33
}
},
"callee": {
"type": "Identifier",
"start": 230,
"end": 239,
"loc": {
"start": {
"line": 13,
"column": 22
},
"end": {
"line": 13,
"column": 31
},
"identifierName": "LocalZone"
},
"name": "LocalZone"
},
"arguments": []
}
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ReturnStatement",
"start": 253,
"end": 270,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 21
}
},
"argument": {
"type": "Identifier",
"start": 260,
"end": 269,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 20
},
"identifierName": "singleton"
},
"name": "singleton"
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 278,
"end": 314,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 282,
"end": 286,
"loc": {
"start": {
"line": 18,
"column": 6
},
"end": {
"line": 18,
"column": 10
},
"identifierName": "type"
},
"name": "type"
},
"static": false,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 289,
"end": 314,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 295,
"end": 310,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 19
}
},
"argument": {
"type": "StringLiteral",
"start": 302,
"end": 309,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 18
}
},
"extra": {
"rawValue": "local",
"raw": "'local'"
},
"value": "local"
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 318,
"end": 503,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 26,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 322,
"end": 326,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 22,
"column": 10
},
"identifierName": "name"
},
"name": "name"
},
"static": false,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 329,
"end": 503,
"loc": {
"start": {
"line": 22,
"column": 13
},
"end": {
"line": 26,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 335,
"end": 499,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 25,
"column": 26
}
},
"test": {
"type": "LogicalExpression",
"start": 339,
"end": 402,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 71
}
},
"left": {
"type": "CallExpression",
"start": 339,
"end": 361,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 30
}
},
"callee": {
"type": "MemberExpression",
"start": 339,
"end": 355,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 339,
"end": 343,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 12
},
"identifierName": "Util"
},
"name": "Util"
},
"property": {
"type": "Identifier",
"start": 344,
"end": 355,
"loc": {
"start": {
"line": 23,
"column": 13
},
"end": {
"line": 23,
"column": 24
},
"identifierName": "isUndefined"
},
"name": "isUndefined"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 356,
"end": 360,
"loc": {
"start": {
"line": 23,
"column": 25
},
"end": {
"line": 23,
"column": 29
},
"identifierName": "Intl"
},
"name": "Intl"
}
]
},
"operator": "&&",
"right": {
"type": "CallExpression",
"start": 365,
"end": 402,
"loc": {
"start": {
"line": 23,
"column": 34
},
"end": {
"line": 23,
"column": 71
}
},
"callee": {
"type": "MemberExpression",
"start": 365,
"end": 381,
"loc": {
"start": {
"line": 23,
"column": 34
},
"end": {
"line": 23,
"column": 50
}
},
"object": {
"type": "Identifier",
"start": 365,
"end": 369,
"loc": {
"start": {
"line": 23,
"column": 34
},
"end": {
"line": 23,
"column": 38
},
"identifierName": "Util"
},
"name": "Util"
},
"property": {
"type": "Identifier",
"start": 370,
"end": 381,
"loc": {
"start": {
"line": 23,
"column": 39
},
"end": {
"line": 23,
"column": 50
},
"identifierName": "isUndefined"
},
"name": "isUndefined"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 382,
"end": 401,
"loc": {
"start": {
"line": 23,
"column": 51
},
"end": {
"line": 23,
"column": 70
}
},
"object": {
"type": "Identifier",
"start": 382,
"end": 386,
"loc": {
"start": {
"line": 23,
"column": 51
},
"end": {
"line": 23,
"column": 55
},
"identifierName": "Intl"
},
"name": "Intl"
},
"property": {
"type": "Identifier",
"start": 387,
"end": 401,
"loc": {
"start": {
"line": 23,
"column": 56
},
"end": {
"line": 23,
"column": 70
},
"identifierName": "DateTimeFormat"
},
"name": "DateTimeFormat"
},
"computed": false
}
]
}
},
"consequent": {
"type": "BlockStatement",
"start": 404,
"end": 478,
"loc": {
"start": {
"line": 23,
"column": 73
},
"end": {
"line": 25,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 412,
"end": 472,
"loc": {
"start": {
"line": 24,
"column": 6
},
"end": {
"line": 24,
"column": 66
}
},
"argument": {
"type": "MemberExpression",
"start": 419,
"end": 471,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 65
}
},
"object": {
"type": "CallExpression",
"start": 419,
"end": 462,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 56
}
},
"callee": {
"type": "MemberExpression",
"start": 419,
"end": 460,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 54
}
},
"object": {
"type": "NewExpression",
"start": 419,
"end": 444,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 38
}
},
"callee": {
"type": "MemberExpression",
"start": 423,
"end": 442,
"loc": {
"start": {
"line": 24,
"column": 17
},
"end": {
"line": 24,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 423,
"end": 427,
"loc": {
"start": {
"line": 24,
"column": 17
},
"end": {
"line": 24,
"column": 21
},
"identifierName": "Intl"
},
"name": "Intl"
},
"property": {
"type": "Identifier",
"start": 428,
"end": 442,
"loc": {
"start": {
"line": 24,
"column": 22
},
"end": {
"line": 24,
"column": 36
},
"identifierName": "DateTimeFormat"
},
"name": "DateTimeFormat"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 445,
"end": 460,
"loc": {
"start": {
"line": 24,
"column": 39
},
"end": {
"line": 24,
"column": 54
},
"identifierName": "resolvedOptions"
},
"name": "resolvedOptions"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 463,
"end": 471,
"loc": {
"start": {
"line": 24,
"column": 57
},
"end": {
"line": 24,
"column": 65
},
"identifierName": "timeZone"
},
"name": "timeZone"
},
"computed": false
}
}
],
"directives": []
},
"alternate": {
"type": "ReturnStatement",
"start": 484,
"end": 499,
"loc": {
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 26
}
},
"argument": {
"type": "StringLiteral",
"start": 491,
"end": 498,
"loc": {
"start": {
"line": 25,
"column": 18
},
"end": {
"line": 25,
"column": 25
}
},
"extra": {
"rawValue": "local",
"raw": "'local'"
},
"value": "local"
}
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 507,
"end": 546,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 30,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 511,
"end": 520,
"loc": {
"start": {
"line": 28,
"column": 6
},
"end": {
"line": 28,
"column": 15
},
"identifierName": "universal"
},
"name": "universal"
},
"static": false,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 523,
"end": 546,
"loc": {
"start": {
"line": 28,
"column": 18
},
"end": {
"line": 30,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 529,
"end": 542,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 17
}
},
"argument": {
"type": "BooleanLiteral",
"start": 536,
"end": 541,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 16
}
},
"value": false
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 550,
"end": 676,
"loc": {
"start": {
"line": 32,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 550,
"end": 560,
"loc": {
"start": {
"line": 32,
"column": 2
},
"end": {
"line": 32,
"column": 12
},
"identifierName": "offsetName"
},
"name": "offsetName"
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 561,
"end": 563,
"loc": {
"start": {
"line": 32,
"column": 13
},
"end": {
"line": 32,
"column": 15
},
"identifierName": "ts"
},
"name": "ts"
},
{
"type": "AssignmentPattern",
"start": 565,
"end": 607,
"loc": {
"start": {
"line": 32,
"column": 17
},
"end": {
"line": 32,
"column": 59
}
},
"left": {
"type": "ObjectPattern",
"start": 565,
"end": 602,
"loc": {
"start": {
"line": 32,
"column": 17
},
"end": {
"line": 32,
"column": 54
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 567,
"end": 582,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 34
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 567,
"end": 573,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 25
},
"identifierName": "format"
},
"name": "format"
},
"value": {
"type": "AssignmentPattern",
"start": 567,
"end": 582,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 34
}
},
"left": {
"type": "Identifier",
"start": 567,
"end": 573,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 25
},
"identifierName": "format"
},
"name": "format"
},
"right": {
"type": "StringLiteral",
"start": 576,
"end": 582,
"loc": {
"start": {
"line": 32,
"column": 28
},
"end": {
"line": 32,
"column": 34
}
},
"extra": {