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

Unit not recognized - parsing issue? #92

Open SophieLM opened 6 years ago

SophieLM commented 6 years ago

Hi,

I need to create two combined units: '% / g/m²' and '°C / g/m²'.

When I used Qty('% / g / m2') or Qty('% / g m-2') or Qty('% m2/g'), I have the error "Unit not recognized". However, when I used Qty('m2/g %'), it is ok.

When I used Qty('degC / g / m2') or Qty('degC / g m-2'), I have the error "Unit not recognized". However, when I used Qty('m2/g degC') or Qty('degC m2/g'), it is ok.

Could be a parsing issue? Did I miss something on documentation?

Thanks in advance for you feedback. Sophie

gentooboontoo commented 6 years ago

You just came across a parsing bug with %. I will try to fix it shortly. It's far from ideal but you could replace % with percent if it is acceptable for your use case.