Roman numerals are a numeral system that originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the Late Middle Ages.
This JavaScript module allows you to convert roman numbers to arabic and vice versa
with ease. It's programmed in TypeScript
so it can be used with both JS & TS projects.
Add module to your project dependencies:
$ npm install romanize-deromanize
Simply include the library
const {romanize, deromanize} = require('romanize-deromanize');
and use the following two methods:
romanize(214); // returns 'CCXIV'
deromanize('DCLXXI'); // returns 671
Code formatting is done by Prettier.
Simply format project files by following predefined rules in .prettierrc.json
:
$ npm run pretty
which is an alias for:
$ npx prettier --write .
To exclude files from formatting, please refer to .prettierignore
(corresponds to .gitignore
).
Identifying problematic patterns is covered by static code analysis tool ESLint:
$ npm run lint
which is an alias for:
$ npx eslint .
Linting config can be found in .eslintrc.json
.
If you want to run all "prod-ready" scripts successively: format, build, lint & test - simply run:
$ npm run all
which is short for:
$ npm run pretty && npm run build && npm run lint & npm run test
Unit tests are conducted using Jest. Run all tests from project root using the following command:
$ npm t
or just run a single test suite by specifying its name, e.g.:
$ npm t romanize.test.ts
If you experience any problems or you just need an extra feature - feel free to create new GitHub repo issue.