Dark Room Covers plugin RegionHide command not isolating regions

This plugin is really useful for my needs, except that I've run into a major issue. When I use the RegionHide plugin command, like:

RegionHide 201

...it doesn't just hide 201 (or whichever I specified), it hides all regions. I'm baffled. I don't know a lot of Javascript, so I can only figure out a little bit of the code, but it looks short and to the point. Maybe someone else could take a glance at it and see why it might be doing this.
That plugin command calls this function, which doesn't check whether you've used the RegionReveal plugin command or not. If you haven't, 'indexOf' will return -1 and then splice(-1, 1) removes the last element in the array. This could be the cause of that behavior.
Code:
Game_Map.prototype.removeFromCurrentlyOpenRegions = function(id) {
    if (!this._openRegionIds) return;
    this._openRegionIds.splice(this._openRegionIds.indexOf(id), 1);
};

Are you using RegionReveal on that ID before trying to use RegionHide on it?
Everything starts off as hidden, so you can't hide anything until you reveal something.

But here's what it is doing. If you hide a region, it will hide the right region the first time. If you send a command to hide the same region again, it will just hide another region, and keep hiding other regions until all your regions are hidden.

This is really unfortunate, and frankly unworkable for me. Is there a way to fix that behavior so it only ever hides the exact regions I tell it to?
Yup, that's exactly what I said it was doing. It's expecting that you use the RegionReveal command on region X before you use RegionHide on region X, because well, that makes sense.

If you try to hide it without having revealed it first, it just removes the last element from the array of revealed regions, which is probably not intentional.

There should be a check to see if the region is not already hidden, try this:

Code:
Game_Map.prototype.removeFromCurrentlyOpenRegions = function(id) {
    if (!this._openRegionIds) return;
    if (this._openRegionIds.includes(id) {
        this._openRegionIds.splice(this._openRegionIds.indexOf(id), 1);
   }
};
Yes, thank you! That's it.

It wasn't working at first, but my editor made a missing paranthesis easy to find, and I noticed code segment above used 'contains' rather than 'includes' so I made the change to be safe. Those two changes give us this, which appears to be working perfectly:

Code:
    Game_Map.prototype.removeFromCurrentlyOpenRegions = function(id) {
        if (!this._openRegionIds) return;
        if (this._openRegionIds.contains(id)) {
            this._openRegionIds.splice(this._openRegionIds.indexOf(id), 1);
           }
    };

Original thread: https://forums.rpgmakerweb.com/threads/dark-room-covers-plugin-regionhide-command-not-isolating-regions.107801/