typescript-roman-numbers-converter
Advanced tools
Comparing version 1.2.1 to 1.2.2
{ | ||
"name": "typescript-roman-numbers-converter", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "TypeScript package that converts arabic number to roman notation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -22,2 +22,3 @@ [![NPM](https://nodei.co/npm/typescript-roman-numbers-converter.png?compact=true)](https://nodei.co/npm/typescript-roman-numbers-converter/) | ||
Converts the given **number** into a **string** that represents the same value in roman notation. | ||
Due to limitations, we cannot convert decimal numbers, numbers below 1 and numbers bigger than 3999. | ||
@@ -60,2 +61,45 @@ <pre> | ||
</code> | ||
</pre> | ||
</pre> | ||
### RomanNumber class | ||
Is the class that holds the value of the roman numeral | ||
<pre> | ||
<code> | ||
class RomanNumber { | ||
//holds the numeric value of the number | ||
num: number; | ||
//holds the roman numeral that represents the value of `num` | ||
str: string; | ||
// elaborations fields for use the large conversion | ||
baseUnits: number = 0; | ||
thousands: number = 0; | ||
constructor(num: number, str: string) { | ||
this.num = num; | ||
this.str = str; | ||
} | ||
} | ||
</code> | ||
</pre> | ||
### toRomanLarge, toRomanLargeStr | ||
toRomanLarge converts the arab number passed as parameter to an instance of RomanNumber class. With this method we can convert numbers bigger than 3999. The string representation of the converted number wraps the thousands with an underscore and round braces. | ||
toRomanLargeStr is returns the value of str after calling toRomanLarge. | ||
<pre> | ||
<code> | ||
let a: number; | ||
let r: RomanNumber(0,''); | ||
let r_2: string; | ||
a = 1350021 | ||
r = toRomanLarge(a); //r is now equal to {num: 1350021, str: "(_MCCCL)XXI", baseUnits: 21, thousands: 1350} | ||
r_2 = toRomanLargeStr(a); //r_2 is now equal to "(_MCCCL)XXI" | ||
</code> | ||
</pre> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3695
104