(Yes, I realise that the among other things the unit key has to be a bit more advanced. A function would probably be best, but you get the picture.)
/ Peter Bortas
Previous text:
2002-12-05 22:51: Subject: Re: CHANGES line of the day
Perhaps that could be solved by feeding the function a constant object or mapping. Something like:
int2size(2048, Foo.BYTES_SIZE_BIN) => "2 KiB" int2size(2048, Foo.BYTES_SIZE_BIN_OLD) => "2 kb" int2size(2000, Foo.BITS_RATE_DEC) => "2 kbps" int2size(17, ([ "unit": " pellefanter", "foo_per_unit": 16, "precision": 17 )] ) => "1.0625 pellefanter"
That way I would at least use the int2size function as a base when building my own.
/ Peter Bortas