/arabic-roman-convert.js

Convert Arabic to Roman UTF-8 numerals: 7 → Ⅶ

Primary LanguageJavaScriptMIT LicenseMIT

arabic-roman-convert.js

Arabic Roman Convert logo

Commitizen friendly XO code style

NPM version Build Status Coveralls Status Dependency Status DevDependency Status

Convert Arabic to Roman UTF-8 numerals: 7 → Ⅶ

Demo: vovanr.github.io/arabic-roman-convert.js

Arabic numerals .arabicToRoman({Number|String})

1 → Ⅰ
2 → Ⅱ
3 → Ⅲ
4 → Ⅳ
5 → Ⅴ
6 → Ⅵ
7 → Ⅶ
8 → Ⅷ
9 → Ⅸ
10 → Ⅹ
11 → Ⅺ
12 → Ⅻ
15 → ⅩⅤ
25 → ⅩⅩⅤ
50 → Ⅼ
100 → Ⅽ
500 → Ⅾ
1000 → Ⅿ

Simple roman strings .convertRoman({String})

I → Ⅰ
III → Ⅲ
vii → Ⅶ
ix → Ⅸ
X → Ⅹ
XV → ⅩⅤ
l → Ⅼ
c → Ⅽ
D → Ⅾ
M → Ⅿ

Arabic number or simple Roman string .toRoman({String|Number})

2 → Ⅱ
III → Ⅲ
vii → Ⅶ
9 → Ⅸ
X → Ⅹ
XV → ⅩⅤ
l → Ⅼ
100 → Ⅽ
D → Ⅾ
M → Ⅿ

Install and Usage

Bower

bower install --save arabic-roman-convert.js
<script src="bower_components/arabic-roman-convert.js/dist/arabic-roman-convert.min.js"></script>
var num = window.ArabicRoman.toRoman(2016);
//=> ⅯⅯⅩⅥ

Node

npm install --save arabic-roman-convert.js
var arabicRomanConvert = require('arabic-roman-convert.js');

var num = arabicRomanConvert.toRoman(2016);
//=> ⅯⅯⅩⅥ

License

MIT © Vladimir Rodkin