Node.js Service Registry – Code Review Stack Exchange

  register(name, version, ip, port) {
    const key = name + version + ip + port;

    if (! { = {}; = Math.floor(new Date() / 1000); = ip; = port; = name; = version;
      this.log.debug(`Added services ${name}, version ${version} at ${ip}:${port}`);
      return key;
    } = Math.floor(new Date() / 1000);
    this.log.debug(`Updated services ${name}, version ${version} at ${ip}:${port}`);
    return key;

I thought the code looked kinda amateurish. I am not sure if I am imagining things. Isn’t there a better way to assign values, also what about how the key is made, shouldn’t we use a random string generator or at least encode it after appending the values? What’s the best practice?