From 9fc6fa6e2308c74394698645b652fbf579b02b88 Mon Sep 17 00:00:00 2001 From: sD Date: Thu, 19 Dec 2019 16:05:18 +0100 Subject: assign looks neat --- webAO/client.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/webAO/client.js b/webAO/client.js index 9f6039e..d1b8cb9 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -560,16 +560,13 @@ class Client extends EventEmitter { } // fix all the funny ini business - if (cini.options === undefined) - cini.options = {}; - if (cini.options.name === undefined) - cini.options.name = chargs[0].toLowerCase(); - if (cini.options.showname === undefined) - cini.options.showname = chargs[0]; - if (cini.options.side === undefined) - cini.options.side = "def"; - if (cini.options.gender === undefined) - cini.options.gender = "male"; + const default_options = { + name: chargs[0].toLowerCase(), + showname: chargs[0], + side: "def", + gender: "male" + }; + cini.options = Object.assign(default_options, cini.options); this.chars[charid] = { name: chargs[0].toLowerCase(), -- cgit