Skip to content

Commit

Permalink
fix(fjagejs): overwrite empty Gateway options argument with defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
notthetup committed Jan 31, 2025
1 parent 3f0df1e commit c19035c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gateways/js/src/fjage.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ export class GenericMessage extends Message {
export class Gateway {

constructor(opts = {}) {
opts = Object.assign({}, GATEWAY_DEFAULTS, opts);
// Similar to Object.assign but also overwrites `undefined` and empty strings with defaults
for (var key in GATEWAY_DEFAULTS){
if (opts[key] == undefined || opts[key] === '') opts[key] = GATEWAY_DEFAULTS[key];
}
var url = DEFAULT_URL;
url.hostname = opts.hostname;
url.port = opts.port;
Expand Down

0 comments on commit c19035c

Please sign in to comment.