JavaScript Library for Converting from/to Roman Numerals | Romanice

romanice – Convert to/from Roman numerals is a dependency-free JavaScript library that converts Arabic numerals (1, 2, 3, …) to Roman numerals (I, II, III, …) and more.

How to make use of it:

1. Install and import the Romanice as an ES module.

# NPM
$ npm i romanice
import * as Romanice from 'romanice';

2. Or load the compiled JavaScript file within the doc.

// From Local
<script src="./dist/romanice.min.js"></script>

// From A CDN
<script src="https://cdn.jsdelivr.net/npm/romanice/dist/romanice.min.js"></script>

3. Create a regular Roman Numeral converter.

const { romanice } = Romanice;
const standardConverter = romanice();

4. Convert Arabic numbers to roman numerals.

const roman = standardConverter.toRoman(1234);
=> MCCXXXIV

5. Convert roman numbers to Arabic numerals.

const decimal = standardConverter.fromRoman('MCCXXXIV');
=> 1234

6. Customize the Roman numeral symbols.

const { romanice, symbols } = Romanice;
const unicodeConverter = romanice(symbols.UNICODE);

const roman = unicodeConverter.toRoman(123456);
=> ↂↀↀⅭⅭⅭⅩⅬⅤ

const decimal = unicodeConverter.fromRoman('ↂↀↀⅭⅭⅭⅩⅬⅤ');
=> 123456

Syntax

romanice([symbols])

symbols – Array of Roman numeral symbols representing the character set. If omitted, assumes the standard symbols ['I', 'V', 'X', 'L', 'C', 'D', 'M'].

Convert Numbers To Roman Numerals, romance Plugin/Github

Convert-to-Roman-numerals-Demo


See Demo And Download

Official Website(dkin-om): Click Here

This superior jQuery/javascript plugin is developed by dkin-om. For extra Advanced Usage, please go to the official website.

Share