Skip to content

Commit 5b8ffcd

Browse files
committed
Remove unneeded type checks (given TS is supported)
1 parent 047fc03 commit 5b8ffcd

File tree

3 files changed

+0
-18
lines changed

3 files changed

+0
-18
lines changed

src/Http.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ class Http {
2828
* @return {*} The response data on success.
2929
*/
3030
async get(endpoint, sort = new SortOptions()) {
31-
if (typeof endpoint !== "string") throw APIError.internal("The 'endpoint' parameter was not a string.");
32-
if (!(sort instanceof SortOptions)) throw APIError.internal("The 'sort' parameter was not of type SortOptions.");
33-
3431
if (sort.isSet()) endpoint += sort.toQueryString();
3532
await this.#throttler.stallIfRequired(false);
3633

@@ -52,8 +49,6 @@ class Http {
5249
* @return {number} The response data on success (ie. a content identifier).
5350
*/
5451
async post(endpoint, body) {
55-
if (typeof endpoint !== "string") throw APIError.internal("The 'endpoint' parameter was not a string.");
56-
5752
await this.#throttler.stallIfRequired(true);
5853

5954
try {
@@ -72,8 +67,6 @@ class Http {
7267
* @param {object} body The request body options.
7368
*/
7469
async patch(endpoint, body) {
75-
if (typeof endpoint !== "string") throw APIError.internal("The 'endpoint' parameter was not a string.");
76-
7770
await this.#throttler.stallIfRequired(true);
7871

7972
try {
@@ -91,8 +84,6 @@ class Http {
9184
* @param {string} endpoint The path of the endpoint (incl. any path parameters).
9285
*/
9386
async delete(endpoint) {
94-
if (typeof endpoint !== "string") throw APIError.internal("The 'endpoint' parameter was not a string.");
95-
9687
await this.#throttler.stallIfRequired(true);
9788

9889
try {
@@ -126,9 +117,6 @@ class Http {
126117
* @return {Array<object>} An array of raw objects.
127118
*/
128119
async listUntil(endpoint, shouldContinue, sort = new SortOptions()) {
129-
if (typeof endpoint !== "string") throw APIError.internal("The 'endpoint' parameter was not a string.");
130-
if (!(sort instanceof SortOptions)) throw APIError.internal("The 'sort' parameter was not of type SortOptions.");
131-
132120
sort.page = 1;
133121

134122
let allData = [];

src/Token.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class Token {
1515
* @param {string} value The value of this token.
1616
*/
1717
constructor(type, value) {
18-
if (!(type instanceof TokenType)) throw APIError.internal("The 'type' parameter was not of type TokenType.");
19-
if (typeof value !== "string") throw APIError.internal("The 'value' parameter was not a string.");
20-
2118
this.#type = type;
2219
this.#value = value;
2320
}

src/Wrapper.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ class Wrapper {
3434
* @param {boolean} health Whether or not to execute a health check during initialisation.
3535
*/
3636
async init(token, health = true) {
37-
if (!(token instanceof Token)) throw APIError.internal("The 'token' parameter was not of type Token.");
38-
if (typeof health !== "boolean") throw APIError.internal("The 'health' parameter was not a boolean.");
39-
4037
let client = axios.create({baseURL: Wrapper.#BASE_URL, headers: token.asHeader()});
4138
this.#http = new Http(client, new Throttler());
4239

0 commit comments

Comments
 (0)