Add option plugin_languages_details (#87)

This commit is contained in:
Simon Lecoq
2021-01-31 12:29:50 +01:00
committed by GitHub
parent 5e57107278
commit bf1453c776
8 changed files with 91 additions and 18 deletions

View File

@@ -36,6 +36,15 @@
return `${(n/v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")} ${u}B`
return `${n} byte${n > 1 ? "s" : ""}`
}
format.bytes = bytes
/** Percentage formatter */
export function percentage(n, {rescale = true} = {}) {
return `${(n*(rescale ? 100 : 1)).toFixed(2)
.replace(/(?<=[.])([1-9]*)(0+)$/, (m, a, b) => a)
.replace(/[.]$/, "")}%`
}
format.percentage = percentage
/** Array shuffler */
export function shuffle(array) {