shared-code-tags-gold-silver (#7056)

This commit is contained in:
Victor Pudeyev
2016-04-12 02:57:57 -05:00
committed by Matteo Pagliazzi
parent a29dd1a1c7
commit 2f1329254e
10 changed files with 127 additions and 23 deletions

View File

@@ -4,10 +4,11 @@ Silver amount from their money
// TODO move to client
module.exports = function(num) {
module.exports = function silver (num) {
if (num) {
return ("0" + Math.floor((num - Math.floor(num)) * 100)).slice(-2);
let centCount = Math.floor((num - Math.floor(num)) * 100);
return `0${centCount}`.slice(-2);
} else {
return "00";
return '00';
}
};