UNPKG

@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,395 lines 263 kB
{ "type": "File", "start": 0, "end": 2921, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 99, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2921, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 99, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 29, "end": 2920, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 98, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 44, "end": 2920, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 98, "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": 2920, "loc": { "start": { "line": 4, "column": 29 }, "end": { "line": 98, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 202, "end": 360, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 202, "end": 213, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 9, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 214, "end": 218, "loc": { "start": { "line": 9, "column": 14 }, "end": { "line": 9, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 220, "end": 236, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 36 } }, "left": { "type": "Identifier", "start": 220, "end": 229, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 232, "end": 236, "loc": { "start": { "line": 9, "column": 32 }, "end": { "line": 9, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 238, "end": 360, "loc": { "start": { "line": 9, "column": 38 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 275, "end": 292, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 275, "end": 291, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 275, "end": 284, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 13 } }, "object": { "type": "ThisExpression", "start": 275, "end": 279, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 280, "end": 284, "loc": { "start": { "line": 13, "column": 9 }, "end": { "line": 13, "column": 13 }, "identifierName": "http" }, "name": "http" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 287, "end": 291, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 20 }, "identifierName": "http" }, "name": "http" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 244, "end": 270, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 298, "end": 324, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 329, "end": 356, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 329, "end": 355, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 329, "end": 343, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 18 } }, "object": { "type": "ThisExpression", "start": 329, "end": 333, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 334, "end": 343, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 18 }, "identifierName": "territory" }, "name": "territory" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 346, "end": 355, "loc": { "start": { "line": 18, "column": 21 }, "end": { "line": 18, "column": 30 }, "identifierName": "territory" }, "name": "territory" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 298, "end": 324, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] } ], "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": 62, "end": 199, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 8, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Set the fetcher's territory.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher.\n * @return {Fetcher}\n ", "start": 364, "end": 534, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 25, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 537, "end": 615, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 29, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 537, "end": 549, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 14 }, "identifierName": "setTerritory" }, "name": "setTerritory", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 550, "end": 559, "loc": { "start": { "line": 26, "column": 15 }, "end": { "line": 26, "column": 24 }, "identifierName": "territory" }, "name": "territory" } ], "body": { "type": "BlockStatement", "start": 561, "end": 615, "loc": { "start": { "line": 26, "column": 26 }, "end": { "line": 29, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 567, "end": 594, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 567, "end": 593, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 567, "end": 581, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 18 } }, "object": { "type": "ThisExpression", "start": 567, "end": 571, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 8 } } }, "property": { "type": "Identifier", "start": 572, "end": 581, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 18 }, "identifierName": "territory" }, "name": "territory" }, "computed": false }, "right": { "type": "Identifier", "start": 584, "end": 593, "loc": { "start": { "line": 27, "column": 21 }, "end": { "line": 27, "column": 30 }, "identifierName": "territory" }, "name": "territory" } } }, { "type": "ReturnStatement", "start": 599, "end": 611, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 606, "end": 610, "loc": { "start": { "line": 28, "column": 11 }, "end": { "line": 28, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Set the fetcher's territory.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher.\n * @return {Fetcher}\n ", "start": 364, "end": 534, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 25, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Gets an object's nested property by path.\n * @ignore\n ", "start": 619, "end": 688, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 34, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 691, "end": 1095, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 48, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 691, "end": 708, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 35, "column": 19 }, "identifierName": "getPropertyByPath" }, "name": "getPropertyByPath", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 709, "end": 715, "loc": { "start": { "line": 35, "column": 20 }, "end": { "line": 35, "column": 26 }, "identifierName": "object" }, "name": "object" }, { "type": "Identifier", "start": 717, "end": 721, "loc": { "start": { "line": 35, "column": 28 }, "end": { "line": 35, "column": 32 }, "identifierName": "path" }, "name": "path" } ], "body": { "type": "BlockStatement", "start": 723, "end": 1095, "loc": { "start": { "line": 35, "column": 34 }, "end": { "line": 48, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 729, "end": 770, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 45 } }, "expression": { "type": "AssignmentExpression", "start": 729, "end": 769, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 44 } }, "operator": "=", "left": { "type": "Identifier", "start": 729, "end": 733, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 8 }, "identifierName": "path" }, "name": "path" }, "right": { "type": "CallExpression", "start": 736, "end": 769, "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 736, "end": 748, "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 23 } }, "object": { "type": "Identifier", "start": 736, "end": 740, "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 15 }, "identifierName": "path" }, "name": "path" }, "property": { "type": "Identifier", "start": 741, "end": 748, "loc": { "start": { "line": 36, "column": 16 }, "end": { "line": 36, "column": 23 }, "identifierName": "replace" }, "name": "replace" }, "computed": false }, "arguments": [ { "type": "RegExpLiteral", "start": 749, "end": 761, "loc": { "start": { "line": 36, "column": 24 }, "end": { "line": 36, "column": 36 } }, "extra": { "raw": "/\\[(\\w+)\\]/g" }, "pattern": "\\[(\\w+)\\]", "flags": "g" }, { "type": "StringLiteral", "start": 763, "end": 768, "loc": { "start": { "line": 36, "column": 38 }, "end": { "line": 36, "column": 43 } }, "extra": { "rawValue": ".$1", "raw": "'.$1'" }, "value": ".$1" } ] } }, "trailingComments": [ { "type": "CommentLine", "value": " convert indexes to properties", "start": 771, "end": 803, "loc": { "start": { "line": 36, "column": 46 }, "end": { "line": 36, "column": 78 } } } ] }, { "type": "ExpressionStatement", "start": 808, "end": 839, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 35 } }, "expression": { "type": "AssignmentExpression", "start": 808, "end": 838, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 34 } }, "operator": "=", "left": { "type": "Identifier", "start": 808, "end": 812, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 8 }, "identifierName": "path" }, "name": "path", "leadingComments": null }, "right": { "type": "CallExpression", "start": 815, "end": 838, "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 815, "end": 827, "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 23 } }, "object": { "type": "Identifier", "start": 815, "end": 819, "loc": { "start": { "line": 37, "column": 11 }, "end": { "line": 37, "column": 15 }, "identifierName": "path" }, "name": "path" }, "property": { "type": "Identifier", "start": 820, "end": 827, "loc": { "start": { "line": 37, "column": 16 }, "end": { "line": 37, "column": 23 }, "identifierName": "replace" }, "name": "replace" }, "computed": false }, "arguments": [ { "type": "RegExpLiteral", "start": 828, "end": 833, "loc": { "start": { "line": 37, "column": 24 }, "end": { "line": 37, "column": 29 } }, "extra": { "raw": "/^\\./" }, "pattern": "^\\.", "flags": "" }, { "type": "StringLiteral", "start": 835, "end": 837, "loc": { "start": { "line": 37, "column": 31 }, "end": { "line": 37, "column": 33 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" } ] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": " convert indexes to properties", "start": 771, "end": 803, "loc": { "start": { "line": 36, "column": 46 }, "end": { "line": 36, "column": 78 } } } ], "trailingComments": [ { "type": "CommentLine", "value": " strip a leading dot", "start": 840, "end": 862, "loc": { "start": { "line": 37, "column": 36 }, "end": { "line": 37, "column": 58 } } } ] }, { "type": "VariableDeclaration", "start": 867, "end": 894, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 38, "column": 31 } }, "declarations": [ { "type": "VariableDeclarator", "start": 871, "end": 893, "loc": { "start": { "line": 38, "column": 8 }, "end": { "line": 38, "column": 30 } }, "id": { "type": "Identifier", "start": 871, "end": 875, "loc": { "start": { "line": 38, "column": 8 }, "end": { "line": 38, "column": 12 }, "identifierName": "keys" }, "name": "keys", "leadingComments": null }, "init": { "type": "CallExpression", "start": 878, "end": 893, "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 30 } }, "callee": { "type": "MemberExpression", "start": 878, "end": 888, "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 25 } }, "object": { "type": "Identifier", "start": 878, "end": 882, "loc": { "start": { "line": 38, "column": 15 }, "end": { "line": 38, "column": 19 }, "identifierName": "path" }, "name": "path" }, "property": { "type": "Identifier", "start": 883, "end": 888, "loc": { "start": { "line": 38, "column": 20 }, "end": { "line": 38, "column": 25 }, "identifierName": "split" }, "name": "split" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 889, "end": 892, "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 29 } }, "extra": { "rawValue": ".", "raw": "'.'" }, "value": "." } ] }, "leadingComments": null } ], "kind": "var", "leadingComments": [ { "type": "CommentLine", "value": " strip a leading dot", "start": 840, "end": 862, "loc": { "start": { "line": 37, "column": 36 }, "end": { "line": 37, "column": 58 } } } ] }, { "type": "ForStatement", "start": 899, "end": 1072, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 46, "column": 5 } }, "init": { "type": "VariableDeclaration", "start": 904, "end": 930, "loc": { "start": { "line": 39, "column": 9 }, "end": { "line": 39, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", "s