commit 5f3493905503986ba9c2361b3a4e71a748dc260c
parent 3ba7ccdd0de02b418df1536b1a4ae33843c85f2b
Author: Agastya Chandrakant <acagastya@outlook.com>
Date: Sun, 16 Aug 2020 17:04:13 +0530
use Object.assign
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/index.js b/index.js
@@ -26,7 +26,7 @@ function pmHandler(sender, msg) {
channels.push(msg);
fs.writeFileSync(
FILE,
- JSON.stringify({ channels, alias }, null, 2) + "\n",
+ JSON.stringify(Object.assign({}, { channels, alias }), null, 2) + "\n",
err => {
if (err) {
ircClient.say(sender, `Error occurred: ${err}.`);
@@ -111,7 +111,7 @@ function addAlias(sender, channel, msg) {
alias[key] = machineReadableValue;
fs.writeFileSync(
FILE,
- JSON.stringify({ channels, alias }, null, 2) + "\n",
+ JSON.stringify(Object.assign({}, { channels, alias }), null, 2) + "\n",
err => {
if (err) {
ircClient.say(channel, `Error occurred: ${err}`);
@@ -134,7 +134,7 @@ function deleteAlias(sender, channel, msg) {
delete alias[key];
fs.writeFileSync(
FILE,
- JSON.stringify({ channels, alias }, null, 2) + "\n",
+ JSON.stringify(Object.assign({}, { channels, alias }), null, 2) + "\n",
err => {
if (err) {
ircClient.say(channel, `Error occurred: ${err}`);