You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requiring or including Sugar polyfills currently immediately apply the polyfill to the global object. For example, the es6 module (which is included in the default package) immediately applies the polyfill for Array#find and others.
Although polyfills are safer to apply to the global object than other methods, considering that Sugar has made concessions about not modifying the global scope by default for other methods, as well as the concept of ponyfills becoming a thing, it may be a good time to reconsider making an exception for polyfills. This would also have the advantage of being simpler to handle in the code, and simpler to grasp for users as well. Polyfills would of course use native methods when they are available.
One potential issue here is that Sugar provides "enhanced" methods, such as array methods like every, which allow shortcuts like every(1) etc. Since these "ponyfills" could be called directly through the global object (i.e. Sugar.Array.every) it would become necessary to create a distinction between the ponyfill and the enhanced method signatures.