/roman-number

parse and stringify Roman numerals

Primary LanguageJavaScript

Roman numbers parser

npm version build status coverage status

const RomanNumber = require('roman-number'); // npm i -S caub/roman-number

const num1 = RomanNumber('XX');
const num2 = RomanNumber(40);

console.log(num1.toInt(), num2.toString()) // 20 'XL'

compatibility

  • node.js >= 6
  • browser (Chrome, Firefox, Edge, IE11, Safari, ..)

(requires String.prototype.repeat, that can be shimmed)