Yep, this is a good point. I think you've highlighted a bigger JS problem, which should be solved instead of making myriads of tiny patches.
I'm sure such map could be implemented as a standalone library. And if it will be popular, it will receive support from community and then it should be adopted to the standard. Maybe there are some. Have you looked at NPM?