Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { HTTPClient } from "./HTTPClient";
import { HTTPClientFactory } from "./HTTPClientFactory";
import { ClientOptions } from "./IClientOptions";
import { Options } from "./IOptions";
import { validatePolyFilling } from "./ValidatePolyFilling";
import { validatePolyfilling } from "./ValidatePolyfilling";

export class Client {
/**
Expand Down Expand Up @@ -70,7 +70,7 @@ export class Client {
* @param {ClientOptions} clientOptions - The options to instantiate the client object
*/
private constructor(clientOptions: ClientOptions) {
validatePolyFilling();
validatePolyfilling();
for (const key in clientOptions) {
if (Object.prototype.hasOwnProperty.call(clientOptions, key)) {
this.config[key] = clientOptions[key];
Expand Down
14 changes: 7 additions & 7 deletions src/ValidatePolyFilling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
* @returns The true in case the Promise and fetch available, otherwise throws error
*/

export const validatePolyFilling = (): boolean => {
export const validatePolyfilling = (): boolean => {
if (typeof Promise === "undefined" && typeof fetch === "undefined") {
const error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");
error.name = "PolyFillNotAvailable";
const error = new Error("Library cannot function without Promise and fetch. So, please provide a polyfill for them.");
error.name = "PolyfillNotAvailable";
throw error;
} else if (typeof Promise === "undefined") {
const error = new Error("Library cannot function without Promise. So, please provide polyfill for it.");
error.name = "PolyFillNotAvailable";
const error = new Error("Library cannot function without Promise. So, please provide a polyfill for it.");
error.name = "PolyfillNotAvailable";
throw error;
} else if (typeof fetch === "undefined") {
const error = new Error("Library cannot function without fetch. So, please provide polyfill for it.");
error.name = "PolyFillNotAvailable";
const error = new Error("Library cannot function without fetch. So, please provide a polyfill for it.");
error.name = "PolyfillNotAvailable";
throw error;
}
return true;
Expand Down