Skip to content
/ romint Public

A simple lib converting roman numerals into integers and vice versa.

Notifications You must be signed in to change notification settings

ctuanle/romint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROMINT

Simple implementation of roman numerals to integer convertor.

Installation

yarn add romint

or

npm install romint

Usage

With typescript:

import Romint from 'romint';
// or import { parseRoman, parseInt } from 'romint';
const ro = Romint.parseRoman(70);
console.log(ro); // 'LXX'
const num = Romint.parseInt(ro);
console.log(num); // 70

With javascript

const romint = require('romint');
console.log(romint.parseInt('MMMCMXCIX')); // 3999

Input validating:

  • for parseRoman: input must be a positive integer less than 4000
  • for parseInt: input must be a valid roman numeral as a string