What about using ES6 Map as cache object?
Ivan Burnaev
11

Yes, definitely. Lodash also allows you to use map for your cache :)

Although I would recommend stringifying the arguements since maps can take even objects as keys and while checking they will end up checking for reference instead of the actual content of the arguements. I prepared a codepen, hope it’s helpful.

Show your support

Clapping shows how much you appreciated Divyanshu Maithani’s story.