add silver leading zero
This commit is contained in:
@@ -269,7 +269,7 @@ module.exports =
|
||||
###
|
||||
silver: (num) ->
|
||||
if num
|
||||
Math.floor (num - Math.floor(num))*100
|
||||
("0" + Math.floor (num - Math.floor(num))*100).slice -2
|
||||
else
|
||||
return "00"
|
||||
|
||||
|
||||
@@ -251,4 +251,5 @@ describe 'Helper', ->
|
||||
it 'calculates silver coins', ->
|
||||
expect(helpers.silver(10)).to.eql 0
|
||||
expect(helpers.silver(1.957)).to.eql 95
|
||||
expect(helpers.silver()).to.eql 0
|
||||
expect(helpers.silver(0.01)).to.eql "01"
|
||||
expect(helpers.silver()).to.eql "00"
|
||||
|
||||
Reference in New Issue
Block a user