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

Are the scalar and baseScalar properties public? #36

Open n-e opened 9 years ago

n-e commented 9 years ago

Hi,

The scalar and baseScalar properties aren't documented in the README.md, though there's a mention in a toFloat exception:

> q('10km').toFloat();
Error: Can't convert to Float unless unitless.  Use Unit#scalar`

Are theses properties public? If so the documentation might need to be updated.

nakedible-p commented 8 years ago

I have the exact same question, are they public? Can I trust them to stay, or must I use q('10km').div('m').toFloat()?

rage-shadowman commented 8 years ago

I always used the scalar member directly, so personally, I consider it part of the public api. And the error message seems to confirm this. But it may be better to have a getScalar function so that we keep the user from modifying it directly.