{"id":17089295,"url":"https://github.com/holdoffhunger/roman-numerals","last_synced_at":"2025-03-23T15:23:53.488Z","repository":{"id":174703242,"uuid":"205271289","full_name":"HoldOffHunger/roman-numerals","owner":"HoldOffHunger","description":"Roman Numerals conversion and utilities.","archived":false,"fork":false,"pushed_at":"2020-06-05T04:03:49.000Z","size":323,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T21:32:59.444Z","etag":null,"topics":["converter","roman","roman-number","roman-number-converter","roman-numbers","roman-numeral","roman-numeral-converter","roman-numerals"],"latest_commit_sha":null,"homepage":"http://www.earthfluent.com/roman-numerals-converter-demo.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HoldOffHunger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["HoldOffHunger"]}},"created_at":"2019-08-30T00:06:11.000Z","updated_at":"2023-09-18T19:24:50.000Z","dependencies_parsed_at":"2023-07-30T12:00:30.155Z","dependency_job_id":null,"html_url":"https://github.com/HoldOffHunger/roman-numerals","commit_stats":null,"previous_names":["holdoffhunger/roman-numerals"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HoldOffHunger%2Froman-numerals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HoldOffHunger%2Froman-numerals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HoldOffHunger%2Froman-numerals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HoldOffHunger%2Froman-numerals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HoldOffHunger","download_url":"https://codeload.github.com/HoldOffHunger/roman-numerals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245120852,"owners_count":20563994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","roman","roman-number","roman-number-converter","roman-numbers","roman-numeral","roman-numeral-converter","roman-numerals"],"created_at":"2024-10-14T13:46:40.402Z","updated_at":"2025-03-23T15:23:53.469Z","avatar_url":"https://github.com/HoldOffHunger.png","language":"JavaScript","funding_links":["https://github.com/sponsors/HoldOffHunger"],"categories":[],"sub_categories":[],"readme":"# Roman Numeral Converter and Utilities\n\n*You* input a Roman Numeral or an integer.\n\n*We* return that number converted.\n\nCovers numbers in the trillions, with thousands of unit tests and tons of Roman Numeral functionality.\n\n\u003cimg src=\"./image/roman-numerals-logo.jpg\" width=\"600\" /\u003e\n\n## TOC\n\n1. [TOC](#toc)\n2. [Online Demos](#online-demos)\n3. [Features](#features)\n4. [Functionality](#funtionality)\n5. [Example Usage](#example-usage)\n6. [Code Structure and Design](#code-structure-and-design)\n\n## Online Demos\n\n_Check out the code in an online demo..._\n\n### Roman Numeral Converter\n\n#### Simple Demo.\n\n_Just click the link, fill in a number, push the button, and go..._\n\n* [Roman Numeral Converter Script, hosted at EarthFluent.com](http://www.earthfluent.com/roman-numerals-converter-demo.html)\n\n### Roman Numeral List Utility\n\n#### Simple Demo.\n\n_Just click the link, push the button, and go..._\n\n* [Roman Numeral Lister Script, hosted at EarthFluent.com](http://www.earthfluent.com/roman-numerals-lister-demo.html)\n\n## Features\n\n\u003cimg src=\"./image/Roman-to-Integer.jpg\" width=\"600\" /\u003e\n\n_How much is here?_\n\n* **Powerful** - Can Handle Any Whole, Positive Number - Capable of handling numbers up to 10^60.\n    * 1 to 3,999 : Represented in the classical way taught to children.\n    * 4,000 to 3,999,999 : Represented with a dash over the high-valued, Roman numerals.  Still traditional, but less so.\n    * 4,000,000 to 3,999,999,999 : Represented with two dashes over the high-valued, Roman numerals.  Untraditional.\n    * 4,000,000,000 to 3,999,999,999,999 : Represented with three dashes over the high-valued, Roman numerals.  Untraditional.\n    * 4,000,000,000,000 to 3.999... * 10^60 : Represented using all unused Latin letters as multiplyer characters.  Brand new.\n* **Fast** - Optimal algorithm design.\n    * Roman-To-Integer Algorithm: Beats 100% of other algorithms on LeetCode.\n    * Integer-To-Roman Algorithm: Beats 100% of other algorithms on LeetCode.\n* **Reliable** - Unit Tests: 40,000 total.\n    * Converting Roman Numerals to Integers : 10,000 unit tests.\n    * Converting Integers to Roman Numerals : 10,000 unit tests.\n    * Listing Roman Numerals : 10,000 unit tests.\n    * Listing Integers : 10,000 unit tests.\n\n## Functionality\n\n\u003cimg src=\"./image/Integer-to-Roman.jpg\" width=\"600\" /\u003e\n\n_How exactly does it work?_\n\n* **Exact / Error-Resistant**\n    * The Roman Numerals are defined linguistically, allowing certain values to appear after others, similar to Markov Chain.\n    * Since this rigid definition is in place, the odds of any particular number generation (up to 10^60) being incorrect is amazingly small.\n* **Fast / Efficient**\n    * Algorithm for Converting: Defined using optimal results.\n    * Algorithm for Listing: Defined using optimal results.\n\n## Example Usage\n\n_How do I use the Roman Numeral Converter and Utilities?_\n\n### Convert Roman Numeral to an Integer\n\n_How do I convert a Roman Numeral to an integer?_\n\n~~~~\nvar output = convertRomanToInteger({'number':'viii'});\n\nconsole.log(output);    // result: 8\n~~~~\n\n### Convert Integer to a Roman Numeral\n\n_How do I convert an integer to a Roman Numeral?_\n\n~~~~\nvar output = convertIntegerToRoman({'number':42});\n\nconsole.log(output);    // result: \"xlii\"\n~~~~\n\n### List Roman Numerals within a Range\n\n_How do I list Roman Numerals within a certain range?_\n\n~~~~\nvar romanlist = generateRomanNumerals({'min':1, 'max':9999});\n\nconsole.log(romanlist[100]);    // result: \"c\"\n~~~~\n\n### List Roman Integers within a Range\n\n_How do I list integers within a certain range?_\n\n~~~~\nvar integerlist = generateIntegerNumbers({'min':1, 'max':9999});\n\nconsole.log(romanlist[100]);    // result: \"100\"\n~~~~\n\n## Code Structure and Design\n\n### Coding Languages\n\n_What coding languages are used in the Roman Numeral Converter and Utilities?_\n\nThe entire project is coded in the following...\n\n* *HTML* - For providing the bare page itself with a minimum of elements.\n* *CSS* - Minimum of styling, as well as handling the odd situation in Roman Numerals where one may need multiple lines over a number to indicate its true, full value.\n* *jQuery* - For handling the UI.\n* *JavaScript* - For doing the number conversions and the utilities.\n\n### roman-numerals.js - Technical Overview\n\n_What are the functions in the sourcecode files for?_\n\n*roman-numerals.js*\n\n_For converting Roman Numerals and Roman Numeral Utilities._\n\n**Globals**\n\n* getTimeOutDelay()\n    * Get the delay of the timeout for typing.\n* processingText()\n    * Get the text to display when the keyword list generator is thinking.\n* waitingForUserText()\n    * Get the text to display when the keyword list generator is waiting.\n\n**Event and Element Handlers**\n\n* $('.input-area').keyup(function(e) {...})\n    * Run findKeywords() only after so much time has delayed from keyup movements.\n* $('.input-area').click(function(e) {...})\n    * Clear the input area of its default instruction set when input area is clicked.\n* $('.find-keywords-button').click(function(e) {...})\n    * User clicked the \"Find Keywords\" button.\n    * Regenerate the keyword list.\n* $('#casing').change(function(e) {...})\n    * User changed the sort order of the keyword lists.\n    * Regenerate the keyword list.\n* initiateApp()\n    * Clear the input area of its default instruction set.\n    * Bound to many event handlers.\n\n**Input Cleanup**\n\n* getInput()\n    * Get the input source for generating the keyword list.\n* cleanupInput(args)\n    * Cleanup the input from the user.\n* formatInput(args)\n    * Format the input from the user.\n    * Specifically, lowercase and, if necessary, strip HTML.\n* getCleanupReplacements()\n    * Get text replacements for cleanup.\n* replaceBulk(args)\n    * Replace the cleanup replacements with their correct values.\n\n**Number-Conversion Logic**\n\n* convertNumbers()\n    * Main function for converting numbers.\n* formatFinalOutput(args)\n    * Given output to display to user, format it.\n* formatOutputWithLines(args)\n    * Given a Roman Numeral value, format it so that it displays the lines/dashes overhead of the number, if applicable.\n* formatOutputWithLines_specialPiece(args)\n    * Put the necessary amount of lines or dashes overhead of a Roman Numeral, based on its size.\n* convertRomanToInteger(args)\n    * Given a Roman Numeral, convert it to a base-10integer.\n* convertIntegerToRoman(args)\n    * Given an Integer (int format), convert it to a Roman Numeral string.\n* convertIntegerToRoman_calculate4PointBlocks(args)\n    * Calculate each set of 4 point blocks, in terms of converting from an integer to a Roman numeral.\n* convertIntegerToRoman_calculate3PointBlocks(args)\n    * Calculate each set of 3 point blocks, in terms of converting from an integer to a Roman numeral.\n* calculate4PointRomanBlock(args)\n    * Given a large Roman Numeral, i.e., a large one, above 1,000, calculate the integer value.\n    * A 4-point-block is lexicographically more complex than the 3-point-block.  The 4-point-block uses more memorization and less logic.\n* calculate3PointRomanBlock(args)\n    * Given ordinary Roman Numeral, i.e., a small one, below 1,000, calculate the integer value.\n    * A 3-point-block is lexicographically-simpler than the 4 point-block.  The 3-point-block uses more logic and less memorization.\n* convertIntegerToRoman_getIncrementersHash()\n    * Build a hash that represents the values of the Roman numeral prefix multiplyers.\n\n**List Builder**\n\n* getIgnoreKeywords_romanNumerals_numbersOnly()\n    * Get a list of Roman numerals to ignore.\n    * For example: i, ii, iii, etc..\n* generateIntegerNumbers(args)\n    * Given a min and a max, return a list of integer numbers bound by that constraint.\n* generateRomanNumerals(args)\n    * Given a min and a max, return a list of Roman Numerals bound by that constraint.\n* formatRomanNumerals(args)\n    * Given an array of Roman numerals, format each element.\n* getIgnoreKeywords_romanNumerals_mergeLists(args)\n    * Given two lists of roman numerals, merge them together.\n    * For example: (i)x, (ii)x, (iii)x, (iv)x,... (ix)x. etc..\n* convertIntegerToRoman_getIncrementers()\n    * Get the prefix incrementers, listed in reverse order.\n    * These are the values before a roman number that cause to be multiplied in value and to appear with so-many dashes overhead.\n    * Active, Enabled, and Tested: O, U, T, A. (trillions)\n    * Disabled for Memory Constraints: B, E, F, G, H, J, K, L, N, P, Q, R, S, W, Y, Z.\n* getRomanNumerals_firstDigitValues()\n    * Get the first digit (0-9) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), i, ii, iii, etc..\n* getRomanNumerals_secondDigitValues()\n    * Get the second digit (00-90) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), x (10), xx (20), xxx (30), etc..\n* getRomanNumerals_thirdDigitValues()\n    * Get the third digit (000-900) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), c (100), cc (200), ccc (300), etc..\n* getRomanNumerals_fourthDigitValues()\n    * Get the fourth digit (0000-9000) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), m (1000), mm (2000), mmm (3000), etc..\n* getRomanNumerals_fifthDigitValues()\n    * Get the fourth digit (00000-90000) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), ox (10000), oxox (20000), oxoxox (30000), etc..\n* getRomanNumerals_sixthDigitValues()\n    * Get the fourth digit (000000-900000) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), oc (100000), ococ (200000), ocococ (300000), etc..\n* getRomanNumerals_seventhDigitValues()\n    * Get the fourth digit (0000000-9000000) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), om (1000000), omom (2000000), omomom (3000000), etc..\n* getRomanNumerals_eighthDigitValues()\n    * Get the fourth digit (00000000-90000000) values for the Roman Numeral system.\n    * For example: (nothing; i.e., zero), om (10000000), omom (20000000), omomom (30000000), etc..\n\n*roman-numerals-unit-tests.js*\n\n_For unit-testing the Roman Numerals and Roman Numeral Utilities._\n\n* enableUnitTests()\n    * Enable unit-testing.\n* logUnitTests()\n    * Enable unit-testing logging.\n* runUnitTests\n    * Run the unit tests.\n* runUnitTests_romanList()\n    * Run the unit tests for the Roman-Numeral generating function.\n* runUnitTests_integerList()\n    * Run the unit tests for the integer-unmber generating function.\n* indicateUnitTestStart()\n    * Indicate the number of unit tests to conduct.\n* indicateUnitTestEnd()\n    * Indicate the number of unit tests conducted.\n* getUnitTestCount()\n    * Count the unit tests. \n* runUnitTests_integerToRoman()\n    * Run the unit tests for converting integers to Roman numerals.\n* runUnitTests_romanToInteger()\n    * Run the unit tests for converting Roman numerals to integers.\n* unitTestList_integerToRoman()\n    * Unit tests for converting integers to roman numerals.\n* unitTestList_romanToInteger()\n    * Unit tests for converting Roman numerals to integers.\n* assert(condition, message)\n    * Simple assert method for unit-testing.\n* main()\n    * Run the unit tests, if enabled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholdoffhunger%2Froman-numerals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholdoffhunger%2Froman-numerals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholdoffhunger%2Froman-numerals/lists"}