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

Add missing unit aliases #90

Closed trodi closed 6 years ago

trodi commented 6 years ago

I ran across the same issue as #85, but for temp-C. Looping through all the Qty.getUnits() and attempting to new Qty(x), I found 17 definitions that didn't list their own name in the alias list. 16 were missing, while 1 was simply misspelled. I've added the missing aliases.

trodi commented 6 years ago

@gentooboontoo, is there any issue with this getting merged?

gentooboontoo commented 6 years ago

Thank you.

rage-shadowman commented 6 years ago

@trodi, looping through all the units and attempting to create an object from them sounds like a good thing to add to the tests, especially since that's how you found these bugs.

trodi commented 6 years ago

@rage-shadowman would you expect the test to live in the "getUnits" or "initialization section of the tests? I'm happy to add the test in another PR if it will be accepted.

rage-shadowman commented 6 years ago

@trodi, that would be a question for @gentooboontoo to answer. If he doesn't care, then I would think either in "initialization" or in its own group. Maybe "aliases"?

trodi commented 6 years ago

@gentooboontoo , any thoughts on this? Also, any chance these changes could be published in a patch release?

gentooboontoo commented 6 years ago

I have just published the patch release.

I don't think adding tests of definitions is very important at this point because I am considering to split unit definitions from the library core to allow choice and customization at runtime. There are too divergent opinions about ways to define and use units (pedantic / pragmatic / customized / etc...).

rage-shadowman commented 6 years ago

Yeah it might be nice to remove all aliases and add only the standard SI and Non-SI unit names, then allow for aliases to be added as desired (newer additions overriding previous ones).