A terminal-based converter that provides the written names for numbers (arabic numerals). For instance, 11 becomes 'eleven'.
This package requires NodeJS and npm.
Clone the repository to your local machine using:
git clone https://github.com/CodeWithOz/arabic2english.git
Change into the newly created folder using:
cd arabic2english/
Run the arabic2english.js
script using the node
command, passing
the desired number as the first argument:
$ node arabic2english.js 65
sixty-five
The parser:
- Only goes up to the quadrillions (18 digits), although higher numbers can easily be extended. See the Larger Than Quadrillions section for more information.
- Only handles digits. Except for the minus sign at the beginning of the number (eg -908), no other non-digit characters are supported. Comma-formatted numbers (eg. 100,090) will yield unexpected results.
After cloning the repository, run npm install
to install all
dependencies.
To handle numbers larger than quadrillions, extend the setsMap
object in the file (currently) located at
./helpers/largeNumbersParser/index.js
by adding more keys from 7
and above. The parser will use your provided name(s) appropriately.
Jest is required to run the tests. With Jest
installed, run npm test
to see the test results.
Note: I used
@babel/register
to ensure compatibility of ES6 imports/exports with NodeJS' cli.
Therefore, your terminal may display a nonsensical console.log
statement when you run npm test
.