https://github.com/dkin-om/romanice
A JavaScript library for converting to/from Roman numerals.
https://github.com/dkin-om/romanice
alphabet converter decimal integer javascript-library latin number numeral numeral-systems roman roman-numerals rome unicode
Last synced: about 2 months ago
JSON representation
A JavaScript library for converting to/from Roman numerals.
- Host: GitHub
- URL: https://github.com/dkin-om/romanice
- Owner: dkin-om
- License: mit
- Created: 2020-09-28T13:43:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-18T13:55:41.000Z (over 3 years ago)
- Last Synced: 2025-10-12T06:54:29.945Z (6 months ago)
- Topics: alphabet, converter, decimal, integer, javascript-library, latin, number, numeral, numeral-systems, roman, roman-numerals, rome, unicode
- Language: JavaScript
- Homepage: https://npm.im/romanice
- Size: 392 KB
- Stars: 7
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# romanice - Convert to/from Roman numerals
[](https://npm.im/romanice)
[](https://npm.im/romanice)
[](https://app.travis-ci.com/github/dkin-om/romanice)
[](https://coveralls.io/github/dkin-om/romanice)
[](https://github.com/dkin-om/romanice/blob/master/LICENSE)
A JavaScript library for converting to/from Roman numerals, e.g., `3888`↔`MMMDCCCLXXXVIII`, `38888`↔`ↂↂↂↁↀↀↀⅮⅭⅭⅭⅬⅩⅩⅩⅤⅠⅠⅠ`
## Install
```
npm install romanice
```
## Import
### CommonJS
```javascript
const Romanice = require('romanice');
```
### ES6
```javascript
import * as Romanice from 'romanice';
```
### Browser
```html
```
## Usage
### Standard - `I`, `V`, `X`, `L`, `C`, `D`, `M`
```javascript
const { romanice } = Romanice;
const standardConverter = romanice();
const roman = standardConverter.toRoman(3888);
// roman === 'MMMDCCCLXXXVIII'
const decimal = standardConverter.fromRoman('MMMCMXCIX');
// decimal === 3999
```
### Unicode - `Ⅰ`, `Ⅴ`, `Ⅹ`, `Ⅼ`, `Ⅽ`, `Ⅾ`, `ↀ`, `ↁ`, `ↂ`
```javascript
const { romanice, symbols } = Romanice;
const unicodeConverter = romanice(symbols.UNICODE);
const roman = unicodeConverter.toRoman(38888);
// roman === 'ↂↂↂↁↀↀↀⅮⅭⅭⅭⅬⅩⅩⅩⅤⅠⅠⅠ'
const decimal = unicodeConverter.fromRoman('ↂↂↂↀↂⅭↀⅩⅭⅠⅩ');
// decimal === 39999
```
## Syntax
### *`romanice([symbols])`*
*`symbols`* - Array of Roman numeral symbols representing the character set. If omitted, assumes the standard symbols `['I', 'V', 'X', 'L', 'C', 'D', 'M']`.
## License
[MIT](https://github.com/dkin-om/romanice/blob/master/LICENSE)