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

"pt" is an alias for both "point" and "pint" #26

Open rage-shadowman opened 9 years ago

rage-shadowman commented 9 years ago

See https://github.com/olbrich/ruby-units/issues/35

gentooboontoo commented 9 years ago

I disagree about the fix made in ruby-units (removal of pt as abbreviation of point). pt is commonly used with font sizes and CSS. I would like to keep the both and disambiguate them through a global setting representing an optional context like typography or cooking for instance. Depending on it, pt would be parsed as pint or point.

rage-shadowman commented 9 years ago

There should definitely be some way to know what 'pt' is going to become before it is used. Right now it depends on the order of the internal UNITS declaration and looping which is not good.

If alias support was added, it would be easy to add a set of 'cooking' aliases or 'typography' aliases. These aliases can override any default aliases, like for 'time' purposes 'm' could become 'minutes' rather than 'meters'.

Ruby-units does allow for aliasing and therefore removing 'pt' as an abbreviation for 'point' shouldn't be an issue for them as you can change it programmatically.