bgrins / TinyColor

Fast, small color manipulation and conversion for JavaScript
https://bgrins.github.io/TinyColor/
MIT License
5.08k stars 438 forks source link

Using prototype #35

Closed marcandre closed 10 years ago

marcandre commented 10 years ago

Is there a good reason why TinyColor doesn't return objects with functions based on a prototype? This makes the memory footprint bigger that it needs to be, and also makes it impossible to monkey patch behaviour. Here's a PR in case you'd like it to work.

Note: there was one test relying on 'alpha' instead of getAlpha(). I presume that was not intended?

bgrins commented 10 years ago

Will you please add a few checks in the "TinyColor initialization" section of the test dealing with creating the object with the new keyword and passing in an existing tinycolor instance as the first parameter to the constructor?

marcandre commented 10 years ago

Good point. Tests added.

bgrins commented 10 years ago

Excellent, thanks! I've now also updated the test suite a bit and added a hook to travis ci: https://travis-ci.org/bgrins/TinyColor.