{"_id":"@dunkelhaiser/numeri-romani","_rev":"7-50dd5269762e4ee3b648b1b3fa9402ee","time":{"created":"2024-05-27T18:44:36.083Z","1.0.0":"2024-05-26T20:12:53.551Z","modified":"2024-05-28T07:43:44.232Z","0.0.0":"2024-05-26T20:21:10.280Z","1.0.1":"2024-05-27T18:44:36.356Z","1.0.2":"2024-05-27T18:52:22.291Z","1.0.3":"2024-05-28T07:43:44.044Z"},"name":"@dunkelhaiser/numeri-romani","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@dunkelhaiser/numeri-romani","version":"1.0.1","description":"Library for work with Roman numbers.","private":false,"keywords":["convert","number","numeral","numerals","roman","arabic","romanize","utils","tools"],"author":{"name":"Kyrylo Tymchyshyn"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Dunkelhaiser/Numeri-Romani.git"},"homepage":"https://github.com/Dunkelhaiser/Numeri-Romani","funding":{"type":"ko-fi","url":"https://ko-fi.com/dunkelhaiser"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","lint-staged":{"./src/**/*":"prettier -uw --cache","./src/**/*.{ts,tsx}":"eslint --fix --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@changesets/cli":"^2.27.3","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.10.0","@typescript-eslint/parser":"^7.10.0","eslint":"^8.56.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.6","eslint-plugin-vitest":"^0.3.24","husky":"^9.0.11","lint-staged":"^15.2.5","prettier":"^3.2.5","tsup":"^8.0.2","typescript":"^5.4.5","vitest":"^1.6.0"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","lint:fix":"eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0","format":"prettier -uw --cache --ignore-path .gitignore .","test":"vitest run","test:watch":"vitest","ci":"pnpm run lint && pnpm run test && pnpm run build","release":"pnpm run lint && pnpm run test && pnpm run build && changeset publish"},"bugs":{"url":"https://github.com/Dunkelhaiser/Numeri-Romani/issues"},"_id":"@dunkelhaiser/numeri-romani@1.0.1","_integrity":"sha512-HJl5UPVm+J5iyGyqpzo3fkyhMVglb07nwS0t4YHsbmum67vrYuM53c0QoiYEi5tX6gAtyE+FsRtg6W+81ACA4g==","_resolved":"/tmp/25ac81d427e78678feca1dcac7e04750/dunkelhaiser-numeri-romani-1.0.1.tgz","_from":"file:dunkelhaiser-numeri-romani-1.0.1.tgz","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-HJl5UPVm+J5iyGyqpzo3fkyhMVglb07nwS0t4YHsbmum67vrYuM53c0QoiYEi5tX6gAtyE+FsRtg6W+81ACA4g==","shasum":"f2849c78077dbdc54d73615ab04e04e4e7e5b273","tarball":"https://registry.npmjs.org/@dunkelhaiser/numeri-romani/-/numeri-romani-1.0.1.tgz","fileCount":8,"unpackedSize":23973,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC1HYkxhDgt+T3QRHY2Kn77hRhIT5fqbUPsk2qEHzmLuAiAO9cD7dEJjPXOuKDkdoLkz7DyacYdYNtyJHRn0Z8Js6w=="}]},"_npmUser":{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"},"directories":{},"maintainers":[{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/numeri-romani_1.0.1_1716835476183_0.5003429344395296"},"_hasShrinkwrap":false},"1.0.2":{"name":"@dunkelhaiser/numeri-romani","version":"1.0.2","description":"Library for work with Roman numbers.","private":false,"keywords":["convert","number","numeral","numerals","roman","arabic","romanize","utils","tools"],"author":{"name":"Kyrylo Tymchyshyn"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Dunkelhaiser/Numeri-Romani.git"},"homepage":"https://github.com/Dunkelhaiser/Numeri-Romani","funding":{"type":"ko-fi","url":"https://ko-fi.com/dunkelhaiser"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","lint-staged":{"./src/**/*":"prettier -uw --cache","./src/**/*.{ts,tsx}":"eslint --fix --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@changesets/cli":"^2.27.3","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.10.0","@typescript-eslint/parser":"^7.10.0","eslint":"^8.56.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.6","eslint-plugin-vitest":"^0.3.24","husky":"^9.0.11","lint-staged":"^15.2.5","prettier":"^3.2.5","tsup":"^8.0.2","typescript":"^5.4.5","vitest":"^1.6.0"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","lint:fix":"eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0","format":"prettier -uw --cache --ignore-path .gitignore .","test":"vitest run","test:watch":"vitest","ci":"pnpm run lint && pnpm run test && pnpm run build","release":"pnpm run lint && pnpm run test && pnpm run build && changeset publish"},"bugs":{"url":"https://github.com/Dunkelhaiser/Numeri-Romani/issues"},"_id":"@dunkelhaiser/numeri-romani@1.0.2","_integrity":"sha512-nrL9ddV/MD4pUffsn7nXmXR0Ky1NejpTe/A+gvP5eOc5GUw2fUbbP3kio8Vrwrby5bwDLwuRuf3/8WlxFsBU8w==","_resolved":"/tmp/6b4a169045094ae15f9e0fafc38d1a01/dunkelhaiser-numeri-romani-1.0.2.tgz","_from":"file:dunkelhaiser-numeri-romani-1.0.2.tgz","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-nrL9ddV/MD4pUffsn7nXmXR0Ky1NejpTe/A+gvP5eOc5GUw2fUbbP3kio8Vrwrby5bwDLwuRuf3/8WlxFsBU8w==","shasum":"ae62dd5cd8e553e929ac96291f0eabb2b16f9c6e","tarball":"https://registry.npmjs.org/@dunkelhaiser/numeri-romani/-/numeri-romani-1.0.2.tgz","fileCount":8,"unpackedSize":24192,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAddFa6tDpJ648ewIzxdRT7VVlY1opvkZei4gjHp6dMZAiBkSoO/ocEefTSKERaW9MtE/diOPEo1Pvv3KsvdPCs3oQ=="}]},"_npmUser":{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"},"directories":{},"maintainers":[{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/numeri-romani_1.0.2_1716835942158_0.8152564952191588"},"_hasShrinkwrap":false},"1.0.3":{"name":"@dunkelhaiser/numeri-romani","version":"1.0.3","description":"Library for work with Roman numbers.","private":false,"keywords":["convert","number","numeral","numerals","roman","arabic","romanize","utils","tools"],"author":{"name":"Kyrylo Tymchyshyn"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Dunkelhaiser/Numeri-Romani.git"},"homepage":"https://github.com/Dunkelhaiser/Numeri-Romani","funding":{"type":"ko-fi","url":"https://ko-fi.com/dunkelhaiser"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","lint-staged":{"./src/**/*":"prettier -uw --cache","./src/**/*.{ts,tsx}":"eslint --fix --report-unused-disable-directives --max-warnings 0"},"devDependencies":{"@changesets/cli":"^2.27.3","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.10.0","@typescript-eslint/parser":"^7.10.0","eslint":"^8.56.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.6","eslint-plugin-vitest":"^0.3.24","husky":"^9.0.11","lint-staged":"^15.2.5","prettier":"^3.2.5","tsup":"^8.0.2","typescript":"^5.4.5","vitest":"^1.6.0"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","lint":"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0","lint:fix":"eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0","format":"prettier -uw --cache --ignore-path .gitignore .","test":"vitest run","test:watch":"vitest","ci":"pnpm run lint && pnpm run test && pnpm run build","release":"pnpm run lint && pnpm run test && pnpm run build && changeset publish"},"bugs":{"url":"https://github.com/Dunkelhaiser/Numeri-Romani/issues"},"_id":"@dunkelhaiser/numeri-romani@1.0.3","_integrity":"sha512-L8YcaQyyYL/I2v+JLwC/X5yp06/eo9FgmiSBB/eFXpbNsbiwo1pDZFmVjaFwiHLzjl4aSBRjBtDqCpDys+8/uA==","_resolved":"/tmp/f46c9eac4dd5573c259e57b16fe3da6c/dunkelhaiser-numeri-romani-1.0.3.tgz","_from":"file:dunkelhaiser-numeri-romani-1.0.3.tgz","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-L8YcaQyyYL/I2v+JLwC/X5yp06/eo9FgmiSBB/eFXpbNsbiwo1pDZFmVjaFwiHLzjl4aSBRjBtDqCpDys+8/uA==","shasum":"10eaa5faf8defab9f8b7800db1ed8d13d6a66d7d","tarball":"https://registry.npmjs.org/@dunkelhaiser/numeri-romani/-/numeri-romani-1.0.3.tgz","fileCount":8,"unpackedSize":24447,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEOFWAbJ6iUoq83AwHUyuDLz0DmWbcnhaqxhymdQjuRJAiEA0Z50P3f7Ip81Ppqo4zOEDivSap2R//xEjjGNzu0kziM="}]},"_npmUser":{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"},"directories":{},"maintainers":[{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/numeri-romani_1.0.3_1716882223913_0.9412403496264443"},"_hasShrinkwrap":false}},"maintainers":[{"name":"dunkelhaiser","email":"tymchyshynkyrylo@gmail.com"}],"description":"Library for work with Roman numbers.","homepage":"https://github.com/Dunkelhaiser/Numeri-Romani","keywords":["convert","number","numeral","numerals","roman","arabic","romanize","utils","tools"],"repository":{"type":"git","url":"git+https://github.com/Dunkelhaiser/Numeri-Romani.git"},"author":{"name":"Kyrylo Tymchyshyn"},"bugs":{"url":"https://github.com/Dunkelhaiser/Numeri-Romani/issues"},"license":"MIT","readme":"# Numeri Romani\n\nJavaScript library for work with Roman numbers.\n\n## Features\n\n- TypeScript and JSDoc support\n- Conversion between Roman and Arabic numbers\n- RomanNumber class\n- Ability to perform basic mathematical operations\n\n## Installation\n\n```sh\nnpm install @dunkelhaiser/numeri-romani\n```\n\n```sh\nyarn add @dunkelhaiser/numeri-romani\n```\n\n```sh\npnpm add @dunkelhaiser/numeri-romani\n```\n\n```sh\nbun add @dunkelhaiser/numeri-romani\n```\n\n## Basic usage\n\n### Importing the Library\n\n#### Using ESM\n\n```ts\nimport { RomanNumber, romanNumerals, romanize, romanizeSafe, arabicize, arabicizeSafe, isValidRoman, isValidRomanSafe, isValidArabic, isValidArabicSafe } from \"@dunkelhaiser/numeri-romani\";\n```\n\n#### Using CommonJS\n\n```ts\nconst { RomanNumber, romanNumerals, romanize, romanizeSafe, arabicize, arabicizeSafe, isValidRoman, isValidRomanSafe, isValidArabic, isValidArabicSafe } = require(\"@dunkelhaiser/numeri-romani\");\n```\n\n### Number conversion\n\n#### Convert to Roman number\n\n```ts\nromanize(379); // => \"CCCLXXIX\"\n```\n\n#### Convert to Arabic number\n\n```ts\narabicize(\"LIV\"); // => 54\n```\n\nWith the default implementation of these functions, if conversion fails, a corresponding error will be thrown explaining the reason for the failure. Default functions use `isValidRoman` and `isValidArabic`, so errors will be the same as theirs.\nIf you don't want to handle errors, you can use *safe* implementations of these functions `romanizeSafe` or `arabicizeSafe` which on fail will return \"\" or NaN correspondingly.\n\n### Validity check\n\n#### Check the validity of the Roman number\n\nTo check if a string is a valid Roman number you can use `isValidRoman` or `isValidRomanSafe`.\n\n```ts\nisValidRoman(\"LIV\"); // => true\nisValidRoman(\"IIV\"); // => Error: Invalid roman number\n```\n\n```ts\nisValidRomanSafe(\"LIV\"); // => true\nisValidRomanSafe(\"IIV\"); // => false\n```\n\n#### Check the validity of the Arabic number\n\nTo check if an Arabic number can be converted into a Roman number you can use `isValidArabic` or `isValidArabicSafe`.\n\n```ts\nisValidArabic(\"LIV\"); // => true\nisValidArabic(5.5); // => Error: Cannot convert non-integer number\nisValidArabic(0); // => Error: Cannot convert zero\nisValidArabic(-2); // => Error: Cannot convert negative numbers\nisValidArabic(-4567); // => Error: Cannot convert numbers greater than 3999\n```\n\n```ts\nisValidArabicSafe(14); // => true\nisValidArabicSafe(5.5); // => false\nisValidArabicSafe(\"14\"); // => false\n```\n\n### RomanNumber class\n\nRomanNumber class provides an ability to create RomanNumber an object that will contain Roman and Arabic numeral values. Also, this object provides arithmetic operations methods.\n\n#### Initialization\n\n```ts\nconst romanNumber = new RomanNumber(7); // { roman: \"VII\", arabic: 7 }\nconst romanNumber = new RomanNumber(\"VII\"); // { roman: \"VII, arabic: 7 }\n```\n\n##### Get values\n\n```ts\nromanNumber.getValue(); // => \"VII\"\nromanNumber.getNumericValue(); // => 7\nromanNumber.getValues(); // => { roman: \"VII\", arabic: 7 }\n```\n\n#### Set value\n\n```ts\nromanNumber.setValue(9); // { roman: \"IX\", arabic: 9 }\nromanNumber.setValue(\"IX\"); // { roman: \"IX\", arabic: 9 }\n```\n\n#### Arithmetic operations\n\nArithmetic operations will update Roman and Arabic values of an instantiated object and return it, so it can be reassigned or method chained.\n\nAll methods support Arabic and Roman numbers as an argument.\nThe Roman number must correspond to the `isValidRoman` function. Arabic number can be any integer value.\n\nThe results of operations must correspond to the `isValidRoman` function or an error will be thrown.\n\n##### Addition\n\n```ts\nromanNumber.add(4).add(\"IV\");\n```\n\n##### Subtraction\n\n```ts\nromanNumber.substract(4).subtract(\"IV\");\n```\n\n##### Multiplication\n\n```ts\nromanNumber.multiply(4).multiply(\"IV\");\n```\n\n##### Division\n\n```ts\nromanNumber.divide(4).divide(\"IV\");\n```\n\n## Contributing\n\n### Bug Reporting\n\nIf you come across a bug or unexpected behavior, please take the time to report it. To file a bug report:\n\n1. Check if the issue has already been reported by searching the [issues](https://github.com/Dunkelhaiser/Numeri-Romani/issues).\n2. If the issue hasn't been reported yet, open a new issue, providing as much detail as possible, including:\n\n- A clear and concise title.\n- A detailed description of the issue.\n- Steps to reproduce the problem.\n- Expected and actual behavior.\n\n### Feature Proposals\n\nTo propose a new feature:\n\n1. Check the [issues](https://github.com/Dunkelhaiser/Numeri-Romani/issues) to ensure it hasn't been proposed before.\n2. Open a new issue, clearly describing the new feature or enhancement you would like to see.\n3. Provide any relevant details or use cases that will help understand the use of the proposed feature.\n\n### Code Contributions\n\nTo contribute code:\n\n1. Fork the repository.\n2. Create a new branch for your changes with a specific prefix: `git checkout -b feat/your-feature`. Accepted prefixes: feat, fix, refactor, docs.\n3. Make your changes, following the coding style.\n4. Write unit tests for your changes.\n5. Update the README or documentation if necessary.\n6. Submit a pull request to the dev branch of the original repository.\n7. Provide a detailed description in the pull request, explaining the purpose of your changes.\n\n## License\n\nCopyright (c) 2024 [Kyrylo Tymchyshyn](https://github.com/Dunkelhaiser)  \nLicensed under the MIT license.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W7LIYO1)\n","readmeFilename":"README.md"}