This project provides a simple utility to convert numerical input to their French word equivalents. The primary purpose is to convert a list of numbers and store the results in a JSON file.
-
Ensure you have Node.js installed on your machine.
-
Clone this repository:
git clone https://github.com/AGSTRANGER/kata
-
Navigate to the project directory:
cd kata
-
Run the conversion script:
node main.js
This will use the default set of numbers provided in
dataSet.js
and generate aresult.json
file containing the converted values.
The project follows separation of concerns and modularity to enhance maintainability and readability.
This file serves as the entry point to the application. It imports the dataset and conversion service to initiate the conversion process.
The services.js
file contains the core functionality for converting numbers to French. It leverages helper functions from helpers.js
for a more modular approach.
This file provides helper functions that perform specific conversion tasks, such as converting units, teens, tens, and handling different ranges of numbers.
The project adheres to coding best practices, including:
-
Separation of Concerns: The code is organized into distinct files (
main.js
,services.js
,helpers.js
) to separate different functionalities and improve code maintainability. -
Modularity: Functions are designed to be modular, with each responsible for a specific conversion task. This enhances code readability and makes it easier to extend or modify the functionality.
-
Error Handling: The
convertToFrench
function includes error handling to address cases where the input number is out of the valid range.
Please note that the dataset and conversion logic can be easily customized to suit specific requirements. Feel free to modify the inputNumbers
in dataSet.js
or use the conversion functions individually as needed.