andrewplummer / Sugar

A Javascript library for working with native objects.
https://sugarjs.com/
MIT License
4.54k stars 305 forks source link

overriding indexOf #1

Closed io41 closed 13 years ago

io41 commented 13 years ago

From the homepage "Sugar will never overwrite methods that already exist" -- in what context is this meant? i.e. you obviously override Array.indexOf.

andrewplummer commented 13 years ago

This is generally meant in the sense that Sugar will never commandeer methods that other libraries add. Specifically I mean libraries such as Prototype.js and Mootools, and I have spent significant time toward testing to assure that this is so. indexOf similarly is only provided in environments where it does not exist (i.e. <= IE8), and will defer to native browser implementations whenever possible.

io41 commented 13 years ago

After a little more testing, I came to the same conclusion. Thanks for your response :-)