clashofclans.js 2.4.0-dev.cedc2ac → 2.4.0-dev.eb4c4f5
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/dist/util/Util.d.ts +2 -1
- package/dist/util/Util.js +15 -4
- package/package.json +1 -1
package/dist/util/Util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClanSearchOptions, SearchOptions } from '../types';
|
|
1
2
|
/** Contains various general-purpose utility methods. */
|
|
2
3
|
export declare class Util extends null {
|
|
3
4
|
/**
|
|
@@ -30,7 +31,7 @@ export declare class Util extends null {
|
|
|
30
31
|
/** Converts API Date to JavaScript Date. */
|
|
31
32
|
static formatDate(date: string): Date;
|
|
32
33
|
/** Returns a string containing a query string suitable for use in a URL. */
|
|
33
|
-
static queryString(options?:
|
|
34
|
+
static queryString(options?: SearchOptions | ClanSearchOptions): string;
|
|
34
35
|
private static getSeasonEnd;
|
|
35
36
|
/** Get current trophy season Id. */
|
|
36
37
|
static getSeasonId(): string;
|
package/dist/util/Util.js
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Util = void 0;
|
|
4
4
|
const TAG_CHARACTERS = '0289PYLQGRJCUV';
|
|
5
|
+
const params = [
|
|
6
|
+
'name',
|
|
7
|
+
'minMembers',
|
|
8
|
+
'maxMembers',
|
|
9
|
+
'minClanPoints',
|
|
10
|
+
'minClanLevel',
|
|
11
|
+
'warFrequency',
|
|
12
|
+
'locationId',
|
|
13
|
+
'labelIds',
|
|
14
|
+
'limit',
|
|
15
|
+
'after',
|
|
16
|
+
'before'
|
|
17
|
+
];
|
|
5
18
|
/** Contains various general-purpose utility methods. */
|
|
6
19
|
class Util extends null {
|
|
7
20
|
/**
|
|
@@ -62,10 +75,8 @@ class Util extends null {
|
|
|
62
75
|
}
|
|
63
76
|
/** Returns a string containing a query string suitable for use in a URL. */
|
|
64
77
|
static queryString(options = {}) {
|
|
65
|
-
const query = new URLSearchParams(options);
|
|
66
|
-
|
|
67
|
-
query.delete(key);
|
|
68
|
-
return query.toString();
|
|
78
|
+
const query = new URLSearchParams(Object.entries(options).filter(([key]) => params.includes(key))).toString();
|
|
79
|
+
return query.length ? `?${query}` : query;
|
|
69
80
|
}
|
|
70
81
|
static getSeasonEnd(month, year, autoFix = true) {
|
|
71
82
|
const now = new Date();
|
package/package.json
CHANGED