Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-roman-numbers-converter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-roman-numbers-converter - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

package.json
{
"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>
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc