A JavaScript library for converting to/from Roman numerals, e.g., 3888
↔MMMDCCCLXXXVIII
, 38888
↔ↂↂↂↁↀↀↀⅮⅭⅭⅭⅬⅩⅩⅩⅤⅠⅠⅠ
npm install romanice
const Romanice = require('romanice');
import * as Romanice from 'romanice';
<script src="https://cdn.jsdelivr.net/npm/romanice/dist/romanice.min.js"></script>
const { romanice } = Romanice;
const standardConverter = romanice();
const roman = standardConverter.toRoman(3888);
// roman === 'MMMDCCCLXXXVIII'
const decimal = standardConverter.fromRoman('MMMCMXCIX');
// decimal === 3999
const { romanice, symbols } = Romanice;
const unicodeConverter = romanice(symbols.UNICODE);
const roman = unicodeConverter.toRoman(38888);
// roman === 'ↂↂↂↁↀↀↀⅮⅭⅭⅭⅬⅩⅩⅩⅤⅠⅠⅠ'
const decimal = unicodeConverter.fromRoman('ↂↂↂↀↂⅭↀⅩⅭⅠⅩ');
// decimal === 39999
symbols
- Array of Roman numeral symbols representing the character set. If omitted, assumes the standard symbols ['I', 'V', 'X', 'L', 'C', 'D', 'M']
.