1.4.0 • Published 3 years ago

roman-num-converter v1.4.0

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

roman-num-converter

A simple package to convert from Roman Numerals and back

  • RomanConverter.toRoman converts an integer to a Roman numeral
  • RomanConverter.fromRoman converts a Roman numeral to an integer
const RomanConverter = require('roman-num-converter');

// examples
console.log(RomanConverter.toRoman(3105));     // MMMCV
console.log(RomanConverter.fromRoman("MMXX")); // 2020

// edge case
console.log(RomanConverter.toRoman(0)); 
//Nulla. The romans did not have a letter representation of the number 0 (zero),
//read more on https://en.wikipedia.org/wiki/Roman_numerals#Zero

// errors
console.log(RomanConverter.fromRoman("K"));     // invalid string
console.log(RomanConverter.toRoman(4000));      // The writing of number above 3999 was never standardized, and it is not a currently supported feature, read more on https://en.wikipedia.org/wiki/Roman_numerals#Large_numbers
1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago