clashofclans.js 2.6.0-dev.3d6d64a → 2.6.0-dev.8cacb3e

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.
@@ -18,7 +18,7 @@ const struct_1 = require("../struct");
18
18
  class Client extends events_1.EventEmitter {
19
19
  constructor(options) {
20
20
  super();
21
- this.rest = new RESTManager_1.RESTManager(options);
21
+ this.rest = new RESTManager_1.RESTManager({ ...options, rejectIfNotValid: true });
22
22
  this.events = new EventManager_1.EventManager(this);
23
23
  }
24
24
  /** Contains various general-purpose utility methods. */
@@ -15,9 +15,9 @@ export interface CacheOptions {
15
15
  */
16
16
  ttl?: number;
17
17
  }
18
- export declare class CacheStore<T = any> implements Store<T> {
18
+ export declare class CacheStore<T> implements Store<T> {
19
19
  private readonly ttl;
20
- private readonly sweepInterval?;
20
+ private readonly sweepInterval;
21
21
  private readonly store;
22
22
  constructor(options?: CacheOptions);
23
23
  private _sweep;
package/dist/util/Util.js CHANGED
@@ -28,7 +28,10 @@ class Util extends null {
28
28
  }
29
29
  /** @internal */
30
30
  static parseTag(tag) {
31
- return `#${tag.toUpperCase().replace(/O/g, '0').replace(/^#/g, '').replace(/\s/g, '')}`;
31
+ if (tag && typeof tag === 'string') {
32
+ return `#${tag.toUpperCase().replace(/O/g, '0').replace(/^#/g, '').replace(/\s/g, '')}`;
33
+ }
34
+ throw new TypeError('The "tag" argument must be of type string.');
32
35
  }
33
36
  /** Encodes a tag as a valid component of a URI. */
34
37
  static encodeURI(tag) {
@@ -47,7 +50,7 @@ class Util extends null {
47
50
  static encodeTag(tag) {
48
51
  const formatted = this.formatTag(tag).substring(1);
49
52
  if (!this.isValidTag(formatted)) {
50
- throw new Error(`Failed to encode tag ${formatted}. RegExp matching failed.`);
53
+ throw new TypeError(`Failed to encode tag ${formatted}. RegExp matching failed.`);
51
54
  }
52
55
  const result = formatted.split('').reduce((sum, char) => sum * BigInt(14) + BigInt(TAG_CHARACTERS.indexOf(char)), BigInt(0));
53
56
  return result.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clashofclans.js",
3
- "version": "2.6.0-dev.3d6d64a",
3
+ "version": "2.6.0-dev.8cacb3e",
4
4
  "description": "JavaScript library for interacting with the Clash of Clans API",
5
5
  "author": "SUVAJIT <suvajit.me@gmail.com>",
6
6
  "license": "MIT",