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

Cannot multiply 2 unit-less instances #8

Closed solarshado closed 10 years ago

solarshado commented 10 years ago

Trivial example in Chrome dev console:

> var one=new Qty('1'), foot=new Qty('ft')
undefined
> one.toString()
"1"
> foot.toString()
"1 ft"
> (one.mul(foot)).toString()
"1 ft"
> (foot.mul(one)).toString()
"1 ft"
> (foot.mul(foot)).toString()
"1 ft2"
> (one.mul(one)).toString()
ERROR: "Unit not recognized"

The error comes from to() when other is unitless

gentooboontoo commented 10 years ago

Fixed. Thanks for the report.