@kkbox/kkbox-js-sdk
Version:
KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.
1,364 lines (1,363 loc) • 248 kB
JSON
{
"type": "File",
"start": 0,
"end": 2959,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 88,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2959,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 88,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 29,
"end": 2959,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 88,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 44,
"end": 2959,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 88,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 50,
"end": 57,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 28
},
"identifierName": "Fetcher"
},
"name": "Fetcher",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 58,
"end": 2959,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 88,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 219,
"end": 409,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 219,
"end": 230,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 231,
"end": 235,
"loc": {
"start": {
"line": 9,
"column": 16
},
"end": {
"line": 9,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 237,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 22
},
"end": {
"line": 9,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 237,
"end": 246,
"loc": {
"start": {
"line": 9,
"column": 22
},
"end": {
"line": 9,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 249,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 34
},
"end": {
"line": 9,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 255,
"end": 409,
"loc": {
"start": {
"line": 9,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 308,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 308,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 24
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 308,
"end": 317,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 308,
"end": 312,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 313,
"end": 317,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 17
},
"identifierName": "http"
},
"name": "http"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 320,
"end": 324,
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 24
},
"identifierName": "http"
},
"name": "http",
"leadingComments": null,
"trailingComments": null
},
"leadingComments": null,
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 265,
"end": 299,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 12,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 334,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 377,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 377,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 377,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 377,
"end": 381,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 382,
"end": 391,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 22
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 394,
"end": 403,
"loc": {
"start": {
"line": 18,
"column": 25
},
"end": {
"line": 18,
"column": 34
},
"identifierName": "territory"
},
"name": "territory"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 334,
"end": 368,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* \n * @param {Http} http \n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher.\n ",
"start": 64,
"end": 214,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 8,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Gets an object's nested property by path.\n * @ignore\n ",
"start": 415,
"end": 490,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 24,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 495,
"end": 975,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 38,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 495,
"end": 512,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 21
},
"identifierName": "getPropertyByPath"
},
"name": "getPropertyByPath",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 513,
"end": 519,
"loc": {
"start": {
"line": 25,
"column": 22
},
"end": {
"line": 25,
"column": 28
},
"identifierName": "object"
},
"name": "object"
},
{
"type": "Identifier",
"start": 521,
"end": 525,
"loc": {
"start": {
"line": 25,
"column": 30
},
"end": {
"line": 25,
"column": 34
},
"identifierName": "path"
},
"name": "path"
}
],
"body": {
"type": "BlockStatement",
"start": 527,
"end": 975,
"loc": {
"start": {
"line": 25,
"column": 36
},
"end": {
"line": 38,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 537,
"end": 578,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 49
}
},
"expression": {
"type": "AssignmentExpression",
"start": 537,
"end": 577,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 48
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 537,
"end": 541,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 12
},
"identifierName": "path"
},
"name": "path"
},
"right": {
"type": "CallExpression",
"start": 544,
"end": 577,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 26,
"column": 48
}
},
"callee": {
"type": "MemberExpression",
"start": 544,
"end": 556,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 26,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 544,
"end": 548,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 26,
"column": 19
},
"identifierName": "path"
},
"name": "path"
},
"property": {
"type": "Identifier",
"start": 549,
"end": 556,
"loc": {
"start": {
"line": 26,
"column": 20
},
"end": {
"line": 26,
"column": 27
},
"identifierName": "replace"
},
"name": "replace"
},
"computed": false
},
"arguments": [
{
"type": "RegExpLiteral",
"start": 557,
"end": 569,
"loc": {
"start": {
"line": 26,
"column": 28
},
"end": {
"line": 26,
"column": 40
}
},
"extra": {
"raw": "/\\[(\\w+)\\]/g"
},
"pattern": "\\[(\\w+)\\]",
"flags": "g"
},
{
"type": "StringLiteral",
"start": 571,
"end": 576,
"loc": {
"start": {
"line": 26,
"column": 42
},
"end": {
"line": 26,
"column": 47
}
},
"extra": {
"rawValue": ".$1",
"raw": "'.$1'"
},
"value": ".$1"
}
]
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " convert indexes to properties",
"start": 579,
"end": 611,
"loc": {
"start": {
"line": 26,
"column": 50
},
"end": {
"line": 26,
"column": 82
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 620,
"end": 651,
"loc": {
"start": {
"line": 27,
"column": 8
},
"end": {
"line": 27,
"column": 39
}
},
"expression": {
"type": "AssignmentExpression",
"start": 620,
"end": 650,
"loc": {
"start": {
"line": 27,
"column": 8
},
"end": {
"line": 27,
"column": 38
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 620,
"end": 624,
"loc": {
"start": {
"line": 27,
"column": 8
},
"end": {
"line": 27,
"column": 12
},
"identifierName": "path"
},
"name": "path",
"leadingComments": null
},
"right": {
"type": "CallExpression",
"start": 627,
"end": 650,
"loc": {
"start": {
"line": 27,
"column": 15
},
"end": {
"line": 27,
"column": 38
}
},
"callee": {
"type": "MemberExpression",
"start": 627,
"end": 639,
"loc": {
"start": {
"line": 27,
"column": 15
},
"end": {
"line": 27,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 627,
"end": 631,
"loc": {
"start": {
"line": 27,
"column": 15
},
"end": {
"line": 27,
"column": 19
},
"identifierName": "path"
},
"name": "path"
},
"property": {
"type": "Identifier",
"start": 632,
"end": 639,
"loc": {
"start": {
"line": 27,
"column": 20
},
"end": {
"line": 27,
"column": 27
},
"identifierName": "replace"
},
"name": "replace"
},
"computed": false
},
"arguments": [
{
"type": "RegExpLiteral",
"start": 640,
"end": 645,
"loc": {
"start": {
"line": 27,
"column": 28
},
"end": {
"line": 27,
"column": 33
}
},
"extra": {
"raw": "/^\\./"
},
"pattern": "^\\.",
"flags": ""
},
{
"type": "StringLiteral",
"start": 647,
"end": 649,
"loc": {
"start": {
"line": 27,
"column": 35
},
"end": {
"line": 27,
"column": 37
}
},
"extra": {
"rawValue": "",
"raw": "''"
},
"value": ""
}
]
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " convert indexes to properties",
"start": 579,
"end": 611,
"loc": {
"start": {
"line": 26,
"column": 50
},
"end": {
"line": 26,
"column": 82
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " strip a leading dot",
"start": 662,
"end": 684,
"loc": {
"start": {
"line": 27,
"column": 50
},
"end": {
"line": 27,
"column": 72
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 693,
"end": 720,
"loc": {
"start": {
"line": 28,
"column": 8
},
"end": {
"line": 28,
"column": 35
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 697,
"end": 719,
"loc": {
"start": {
"line": 28,
"column": 12
},
"end": {
"line": 28,
"column": 34
}
},
"id": {
"type": "Identifier",
"start": 697,
"end": 701,
"loc": {
"start": {
"line": 28,
"column": 12
},
"end": {
"line": 28,
"column": 16
},
"identifierName": "keys"
},
"name": "keys",
"leadingComments": null
},
"init": {
"type": "CallExpression",
"start": 704,
"end": 719,
"loc": {
"start": {
"line": 28,
"column": 19
},
"end": {
"line": 28,
"column": 34
}
},
"callee": {
"type": "MemberExpression",
"start": 704,
"end": 714,
"loc": {
"start": {
"line": 28,
"column": 19
},
"end": {
"line": 28,
"column": 29
}
},
"object": {
"type": "Identifier",
"start": 704,
"end": 708,
"loc": {
"start": {
"line": 28,
"column": 19
},
"end": {
"line": 28,
"column": 23
},
"identifierName": "path"
},
"name": "path"
},
"property": {
"type": "Identifier",
"start": 709,
"end": 714,
"loc": {
"start": {
"line": 28,
"column": 24
},
"end": {
"line": 28,
"column": 29
},
"identifierName": "split"
},
"name": "split"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 715,
"end": 718,
"loc": {
"start": {
"line": 28,
"column": 30
},
"end": {
"line": 28,
"column": 33
}
},
"extra": {
"rawValue": ".",
"raw": "'.'"
},
"value": "."
}
]
},
"leadingComments": null
}
],
"kind": "var",
"leadingComments": [
{
"type": "CommentLine",
"value": " strip a leading dot",
"start": 662,
"end": 684,
"loc": {
"start": {
"line": 27,
"column": 50
},
"end": {
"line": 27,
"column": 72
}
}
}
]
},
{
"type": "ForStatement",
"start": 729,
"end": 946,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 36,
"column": 9
}
},
"init": {
"type": "VariableDeclaration",
"start": 734,
"end": 760,
"loc": {
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 29,
"column": 39
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 738,
"end": 743,
"loc": {
"start": {
"line": 29,
"column": 17
},
"end": {
"line": 29,
"column": 22
}
},
"id": {
"type": "Identifier",
"start": 738,
"end": 739,
"loc": {
"start": {
"line": 29,
"column": 17
},
"end": {
"line": 29,
"column": 18
},
"identifierName": "i"
},
"name": "i"
},
"init": {
"type": "NumericLiteral",
"start": 742,
"end": 743,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 22
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "VariableDeclarator",
"start": 745,
"end": 760,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 745,
"end": 746,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 25
},
"identifierName": "n"
},
"name": "n"
},
"init": {
"type": "MemberExpression",
"start": 749,
"end": 760,
"loc": {
"start": {
"line": 29,
"column": 28
},
"end": {
"line": 29,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 749,
"end": 753,
"loc": {
"start": {
"line": 29,
"column": 28
},
"end": {
"line": 29,
"column": 32
},
"identifierName": "keys"
},
"name": "keys"
},
"property": {
"type": "Identifier",
"start": 754,
"end": 760,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 39
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
}
}
],
"kind": "var"
},
"test": {
"type": "BinaryExpression",
"start": 762,
"end": 767,
"loc": {
"start": {
"line": 29,
"column": 41
},
"end": {
"line": 29,
"column": 46
}
},
"left": {
"type": "Identifier",
"start": 762,
"end": 763,
"loc": {
"start": {
"line": 29,
"column": 41
},
"end": {
"line": 29,
"column": 42
},
"identifierName": "i"
},
"name": "i"
},
"operator": "<",
"right": {
"type": "Identifier",
"start": 766,
"end": 767,
"loc": {
"start": {
"line": 29,
"column": 45
},
"end": {
"line": 29,
"column": 46
},
"identifierName": "n"
},
"name": "n"
}
},
"update": {
"type": "UpdateExpression",
"start": 769,
"end": 772,
"loc": {
"start": {
"line": 29,
"column": 48
},
"end": {
"line": 29,
"column": 51
}
},
"operator": "++",
"prefix": true,
"argument": {
"type": "Identifier",
"start": 771,
"end": 772,
"loc": {