gentooboontoo / js-quantities

JavaScript library for quantity calculation and unit conversion
http://gentooboontoo.github.io/js-quantities/
MIT License
396 stars 102 forks source link

format: stop relying on array properties #131

Open kyrofa opened 2 years ago

kyrofa commented 2 years ago

There are numerous libraries out there (sugarjs, prototypejs) that extend the Array prototype. The simplify function in js-quantities relies on setting/checking properties on an array instance, which means that it's incompatible with such libraries. This PR fixes #130, adding compatibility by using a separate object for keeping track of the counters instead of using properties on array instances.

Note: It was unclear whether I should be including changes to generated files. Please let me know if I should only be changing the src/spec files and I can update this PR.