kopia lustrzana https://github.com/badgen/badgen.net
refactor: replace round() with Number.toFixed()
rodzic
8ba36d5199
commit
b28fb70bc1
|
@ -1,7 +1,6 @@
|
|||
const axios = require('../axios.js')
|
||||
const xml2js = require('xml2js')
|
||||
const millify = require('millify')
|
||||
const round = require('../utils/round.js')
|
||||
const stars = require('../utils/stars.js')
|
||||
const semColor = require('../utils/sem-color.js')
|
||||
|
||||
|
@ -32,7 +31,7 @@ module.exports = async function (topic, ...args) {
|
|||
case 'rating':
|
||||
return {
|
||||
subject: 'rating',
|
||||
status: `${round(addon.rating, 2)}/5`,
|
||||
status: `${Number(addon.rating).toFixed(2)}/5`,
|
||||
color: 'green'
|
||||
}
|
||||
case 'stars':
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const webstore = require('chrome-webstore')
|
||||
const millify = require('millify')
|
||||
const round = require('../utils/round.js')
|
||||
const stars = require('../utils/stars.js')
|
||||
const semColor = require('../utils/sem-color.js')
|
||||
|
||||
|
@ -28,7 +27,7 @@ module.exports = async function (topic, ...args) {
|
|||
case 'rating':
|
||||
return {
|
||||
subject: 'rating',
|
||||
status: `${round(meta.rating.average, 2)}/5`,
|
||||
status: `${Number(meta.rating.average).toFixed(2)}/5`,
|
||||
color: 'green'
|
||||
}
|
||||
case 'stars':
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const axios = require('../axios.js')
|
||||
const covColor = require('../utils/cov-color.js')
|
||||
const round = require('../utils/round.js')
|
||||
|
||||
const unknownBadge = {
|
||||
subject: 'codecov',
|
||||
|
@ -38,7 +37,7 @@ async function coverage (vscType, user, repo, branch) {
|
|||
|
||||
return {
|
||||
subject: 'coverage',
|
||||
status: round(data.commit.totals.c, 1) + '%',
|
||||
status: Number(data.commit.totals.c).toFixed(1) + '%',
|
||||
color: covColor(data.commit.totals.c)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const axios = require('../axios.js')
|
||||
const covColor = require('../utils/cov-color.js')
|
||||
const round = require('../utils/round.js')
|
||||
|
||||
module.exports = async function (topic, platform, user, repo, branch) {
|
||||
// only support topic="c" fow now
|
||||
|
@ -13,7 +12,7 @@ module.exports = async function (topic, platform, user, repo, branch) {
|
|||
|
||||
return {
|
||||
subject: 'coverage',
|
||||
status: round(covered_percent, 1) + '%',
|
||||
status: Number(covered_percent).toFixed(1) + '%',
|
||||
color: covColor(covered_percent)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = (value, decimals) => {
|
||||
return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals)
|
||||
}
|
Ładowanie…
Reference in New Issue