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

Defining a new unit #96

Open b-v opened 5 years ago

b-v commented 5 years ago

I was wondering whether it is possible to define a new unit as in ruby-units (Unit.define), without changing the source code (that is, the variable UNITS in definitions.js)? For example, for sporadically used units?

phil-mitchell commented 3 years ago

I had this need as well so I created a PR. Maybe it will be accepted?

sanzoghenzo commented 3 years ago

Hi @phil-mitchell, I see that you closed the PR; can I ask you why? have you found a better solution?

phil-mitchell commented 3 years ago

@sanzoghenzo too much time had passed and I had forgotten what was going on and I just created my own much simpler implementation for what I needed in the meantime.

rage-shadowman commented 3 years ago

Bummer... I would've like to have seen this make it in.

MatousAc commented 1 year ago

@sanzoghenzo Same. Is there some way I can stir up interest for this again? The app I'm building needs to be able to define its own units. I'm kinda still a junior programmer, so could I get a tip here? If no one has time to try to pull this change in, but I want to have the functionality, how to I get it in the easiest way? Should I work the changes here into my own fork of the js-quantities repo? If I did that, I'd have to make a new npm package since that is how I am using it right now, right? Or is there some easier way?

adrfantini commented 9 months ago

I am also interested in this implementation and might get some funding for it if there is the need for that @gentooboontoo

MatousAc commented 9 months ago

@adrfantini I know this doesn't solve this issue, but I needed this feature, so I used Unitmath instead.