js-quantities icon indicating copy to clipboard operation
js-quantities copied to clipboard

Defining a new unit

Open b-v opened this issue 6 years ago • 7 comments

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?

b-v avatar Jan 09 '19 18:01 b-v

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

phil-mitchell avatar Dec 07 '20 22:12 phil-mitchell

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

sanzoghenzo avatar Mar 09 '21 15:03 sanzoghenzo

@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.

phil-mitchell avatar Mar 09 '21 16:03 phil-mitchell

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

rage-shadowman avatar Mar 12 '21 18:03 rage-shadowman

@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?

MatousAc avatar Nov 14 '22 03:11 MatousAc

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

adrfantini avatar Nov 22 '23 08:11 adrfantini

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

MatousAc avatar Nov 22 '23 16:11 MatousAc