osrs-json-hiscores 2.21.0 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/hiscores.d.ts +1 -1
- package/lib/hiscores.js +5 -4
- package/package.json +1 -1
package/lib/hiscores.d.ts
CHANGED
@@ -16,7 +16,7 @@ export declare function getOfficialStats(rsn: string, mode?: Gamemode, config?:
|
|
16
16
|
* @param config Optional axios request config object.
|
17
17
|
* @returns Formatted version of the rsn.
|
18
18
|
*/
|
19
|
-
export declare function getRSNFormat(rsn: string, config?: AxiosRequestConfig): Promise<string>;
|
19
|
+
export declare function getRSNFormat(rsn: string, config?: AxiosRequestConfig, mode?: Gamemode): Promise<string>;
|
20
20
|
/**
|
21
21
|
* Parses official JSON object of raw stats and returns a stats object.
|
22
22
|
*
|
package/lib/hiscores.js
CHANGED
@@ -96,14 +96,15 @@ exports.getOfficialStats = getOfficialStats;
|
|
96
96
|
* @param config Optional axios request config object.
|
97
97
|
* @returns Formatted version of the rsn.
|
98
98
|
*/
|
99
|
-
function getRSNFormat(rsn, config) {
|
99
|
+
function getRSNFormat(rsn, config, mode) {
|
100
|
+
if (mode === void 0) { mode = 'main'; }
|
100
101
|
return __awaiter(this, void 0, void 0, function () {
|
101
102
|
var url, response, dom, anchor, _a;
|
102
103
|
return __generator(this, function (_b) {
|
103
104
|
switch (_b.label) {
|
104
105
|
case 0:
|
105
106
|
(0, utils_1.validateRSN)(rsn);
|
106
|
-
url = (0, utils_1.getPlayerTableURL)(
|
107
|
+
url = (0, utils_1.getPlayerTableURL)(mode, rsn);
|
107
108
|
_b.label = 1;
|
108
109
|
case 1:
|
109
110
|
_b.trys.push([1, 3, , 4]);
|
@@ -115,11 +116,11 @@ function getRSNFormat(rsn, config) {
|
|
115
116
|
if (anchor) {
|
116
117
|
return [2 /*return*/, (0, utils_1.rsnFromElement)(anchor)];
|
117
118
|
}
|
118
|
-
|
119
|
+
return [3 /*break*/, 4];
|
119
120
|
case 3:
|
120
121
|
_a = _b.sent();
|
121
122
|
throw new utils_1.HiScoresError();
|
122
|
-
case 4:
|
123
|
+
case 4: throw new utils_1.PlayerNotFoundError();
|
123
124
|
}
|
124
125
|
});
|
125
126
|
});
|