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

(No Bug) Missing property _units for quantities with base units #81

Closed librilex closed 7 years ago

librilex commented 7 years ago

All quantities created with base units and without prefixes do not have the property _units defined. Example: Qty('1 A')._units is undefined, Qty('1 kg'))._units as well.

Is this a bug or on purpose?

(tested with v1.6.6)

librilex commented 7 years ago

I figured out that _units is only assigned to quantities with non-base units. To call the units from quantities with base units (and all other units) it is sufficient to use the function units().

gentooboontoo commented 7 years ago

It is a private property. As you figured out, it is not meant to be called by client code.