Number
A number the way a reader wants it: money, compact, percent, time. Missing is "–", never 0.
kit.num()- No CSS of its own
- No script needed
Use it
On your server
const kit = require('openvibe-shared/kit');
const html = [kit.num(12.5,
'money'), kit.num(0.027,
'money'), kit.num(1234567,
'compact'), kit.num(0.375,
'percent'), kit.num(2400,
'ms'), kit.num(null,
'int')].join(' · ');In a page that draws itself
<link rel="stylesheet" href="https://openvibe.network/shared/kit.css">
<script src="https://openvibe.network/shared/kit.js"></script>
<script>
const box = document.querySelector('#here');
box.innerHTML = [OpenVibeKit.num(12.5,
'money'), OpenVibeKit.num(0.027,
'money'), OpenVibeKit.num(1234567,
'compact'), OpenVibeKit.num(0.375,
'percent'), OpenVibeKit.num(2400,
'ms'), OpenVibeKit.num(null,
'int')].join(' · ');
OpenVibeKit.enhance(box);
</script>The HTML it returns · 48 B
$12.50 · $0.027 · 1.2M · 0.4% · 2.4 s · –What it weighs
Nothing of its own: it is text, styled by whatever holds it.