Skip to content

Commit

Permalink
Code optimization [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Nov 19, 2023
1 parent b4bc1db commit f143d1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export class Client {
* @param {ClientOptions} [options] An object providing values to initialize this instance.
*/
constructor(apiKey, blog, options = {}) {
const baseUrl = options.baseUrl ?? "https://rest.akismet.com";
this.apiKey = apiKey;
this.baseUrl = new URL(options.baseUrl ?? "https://rest.akismet.com/");
this.baseUrl = new URL(baseUrl.slice(-1) == "/" ? baseUrl : `${baseUrl}/`);
this.blog = blog;
this.isTest = options.isTest ?? false;
this.userAgent = options.userAgent ?? `Node.js/${version.slice(1)} | Akismet/${Client.#version}`;
Expand Down

0 comments on commit f143d1b

Please sign in to comment.