MV Disabling any Key Input with specific mapped Key Name

How do I disable a key input with specific mapped Key Name?

For example, up(38) and w(87) and T(84) are mapped with 'up'.

How can I script it so that:
- check any key mapped with name 'up': disable them by changing key name to 'null'
Hello,
I think this should work. It works in a JS sandbox.

Edit: Whoops, I did that wrong. Here it is updated to affect Input.KeyMapper instead of the copied value.
JavaScript:
for (let [key, value] of Object.entries(Input.keyMapper)) {
  if (value == 'up') {
        Input.keyMapper[key] = null;
          //console.log(Input.keyMapper[key]); //uncomment this line if you want to visually see value is reset.
    }
}

Put it in a function and you can pass whatever mapped name you want.

Just remember that you will have to reassign your buttons at some point to the proper value.
Also, big note, this only checks for the keyMapper not the gamepadMapper (Though you should be able to run he same check on Input.gamepadMapper). I have no idea what goes on with Touch, so I can't help there.
Just tested this thoroughly, and it's perfect! Reversing likewise works!

Thank you so much, @autodidact !
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/disabling-any-key-input-with-specific-mapped-key-name.139580/