bitpay/bitcore — pull request #627 by yemel (2014-12-01 15:44:41+00:00)
Title: Utility for unit conversion

Allows the following idioms:

```
var unit, value;

// new unit instance
unit = new Unit(amount, Unit.Satoshis);
unit = Unit.fromSatoshis(amount);

// get representation alternatives
value = unit.bits;
value = unit.toSatoshis();
value = unit.to(Unit.mBTC);

// some use cases
value = Unit.fromBTC(amount).toSatoshis();
value = new Unit(amount, unitPreference).toSatoshis();
value = Unit.fromSatoshis(amount).to(unitPreference);
```