Browse Source

Merge pull request #11 from braydonf/millis

Millis
patch-2
Patrick Nagurny 9 years ago
parent
commit
d23d53e587
  1. 2
      .coveralls.yml
  2. 4
      lib/unit.js
  3. 4
      test/unit.js

2
.coveralls.yml

@ -1 +1 @@
repo_token: DPmQxVTui2krriKgoXsUS4ahhOAEY6Ron repo_token: 5ki6iPbGaiwHzIwcfNDzTXoiqAcffqUQs

4
lib/unit.js

@ -95,7 +95,7 @@ Unit.fromBTC = function(amount) {
* @param {Number} amount - The amount in mBTC * @param {Number} amount - The amount in mBTC
* @returns {Unit} A Unit instance * @returns {Unit} A Unit instance
*/ */
Unit.fromMilis = function(amount) { Unit.fromMillis = Unit.fromMilis = function(amount) {
return new Unit(amount, Unit.mBTC); return new Unit(amount, Unit.mBTC);
}; };
@ -173,7 +173,7 @@ Unit.prototype.toBTC = function() {
* *
* @returns {Number} The value converted to mBTC * @returns {Number} The value converted to mBTC
*/ */
Unit.prototype.toMilis = function() { Unit.prototype.toMillis = Unit.prototype.toMilis = function() {
return this.to(Unit.mBTC); return this.to(Unit.mBTC);
}; };

4
test/unit.js

@ -49,6 +49,9 @@ describe('Unit', function() {
unit = Unit.fromMilis('1.00001'); unit = Unit.fromMilis('1.00001');
unit.mBTC.should.equal(1.00001); unit.mBTC.should.equal(1.00001);
unit = Unit.fromMillis('1.00001');
unit.mBTC.should.equal(1.00001);
unit = Unit.fromBits('100'); unit = Unit.fromBits('100');
unit.bits.should.equal(100); unit.bits.should.equal(100);
@ -136,6 +139,7 @@ describe('Unit', function() {
var unit = new Unit(1.3, 'BTC'); var unit = new Unit(1.3, 'BTC');
unit.toBTC().should.equal(unit.BTC); unit.toBTC().should.equal(unit.BTC);
unit.toMilis().should.equal(unit.mBTC); unit.toMilis().should.equal(unit.mBTC);
unit.toMillis().should.equal(unit.mBTC);
unit.toBits().should.equal(unit.bits); unit.toBits().should.equal(unit.bits);
unit.toSatoshis().should.equal(unit.satoshis); unit.toSatoshis().should.equal(unit.satoshis);
}); });

Loading…
Cancel
Save