Typescript Roman Numbers Converter
A simple and easy to use Typescript package that converts a given arabic number to roman number format
Installation
$ npm install --save typescript-roman-numbers-converter
How to use it
First of all import the package:
import { toRoman } from "typescript-roman-numbers-converter";
toRoman
Converts the given number into a string that represents the same value in roman notation.
let a: number;
let r: string;
a = 32
r = toRoman(a); //r is now equal to "XXXII"
let a_2 = -12
r = toRoman(a_2); //r is now "" due to limitations
toArabic
Converts the given string into a number that represents the same value in arabic notation.
let a: number;
let r: string;
r = "XXXII"
a = toArabic(a); //a is now equal to 32
isRoman
Returns true if the given string is a valid written roman number
let b = isRoman("MCM"); //b is true
let b_2 = isRoman("ABC"); //b_2 is false