Metamorphosis with Proxy and Reflect

Raju Gandhi · Apress eBooks · 2019

No API can or should attempt to be complete. Depending on the use-case, and the problem space, we often find that we may need to add, remove, or even constraint behavior to an object, or a type. Historically our approach to this was leveraging JavaScript’s dynamic nature, and simply tack on the additional behavior we wanted to see on any object. Symbols can help in this regard, by giving us the guarantee of collision-free keys. However, in many cases it can feel a tad hackish, especially when we do not wish to permanently modify behavior of an object for the lifetime of our application.

Read the paper · More papers on PaperTik