-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
umd.html
36 lines (36 loc) · 1.13 KB
/
umd.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>numericQuantity UMD Example</title>
<style>
#app {
font-family: 'Courier New', Courier, monospace;
display: flex;
flex-direction: column;
gap: 0.8rem;
padding: 0.8rem;
}
</style>
</head>
<body>
<div id="app">
<div data-input="1/2"></div>
<div data-input="1 1/2"></div>
<div data-input="1.5"></div>
<div data-input="XII"></div>
</div>
<script src="https://unpkg.com/numeric-quantity"></script>
<script>
for (const div of document.querySelectorAll('#app>div')) {
const input = div.attributes.getNamedItem('data-input').value;
div.innerText = `NumericQuantity.numericQuantity('${input}', { allowTrailingInvalid: true, romanNumerals: true }) === ${NumericQuantity.numericQuantity(
input,
{ allowTrailingInvalid: true, romanNumerals: true }
)}`;
}
</script>
</body>
</html>