MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / h2k

Function h2k

lib/function.js:34–45  ·  view source on GitHub ↗
(eco)

Source from the content-addressed store, hash-verified

32}
33
34const h2k = (eco) => {
35 var lyrik = ['', 'K', 'M', 'B', 'T', 'P', 'E']
36 var ma = Math.log10(Math.abs(eco)) / 3 | 0
37 if (ma == 0) return eco
38 var ppo = lyrik[ma]
39 var scale = Math.pow(10, ma * 3)
40 var scaled = eco / scale
41 var formatt = scaled.toFixed(1)
42 if (/\.0$/.test(formatt))
43 formatt = formatt.substr(0, formatt.length - 2)
44 return formatt + ppo
45}
46
47const isUrl = (url) => {
48 return url.match(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected