Skip to content

Commit

Permalink
Use splice to avoid leaving empty nulls behind
Browse files Browse the repository at this point in the history
  • Loading branch information
earldouglas committed Jan 7, 2017
1 parent 312d08d commit ef4618f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/listeners/message/auto-reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function messageListener(db, from, channel, message) {
var index = findReply(name,replies);

if (index != replies.length) {
delete replies[index]
replies.splice(index, 1);
}

replies[index] = { count: 10, name:name, regex: regex, flags: flags, reply: reply, };
Expand All @@ -80,7 +80,7 @@ function messageListener(db, from, channel, message) {
replies[i].count = replies[i].count || 10;
replies[i].count = replies[i].count - 1;
if (replies[i].count <= 0) {
delete replies[i];
replies.splice(i, 1);
}
}
}
Expand Down

0 comments on commit ef4618f

Please sign in to comment.