gitdagray / csv-to-sql-insert

Provide table data as a CSV (comma-separated values) file and output a SQL insert statement for a table with the same name as the file.
MIT License
97 stars 122 forks source link

Code Refactoring: Decoupling / Pass process.args as parameters #44

Open ahmad-511 opened 10 months ago

ahmad-511 commented 10 months ago

Instead of depending on process.args inside both writeSQL and readCSV functions, we can simply pass necessary CLI arguments as function parameters. This will make it easier to maintain and it will also give priority to the function arguments over the CLI argument which can be useful in case (in a future update) we want to dynamically change the output file name (ex: splitting big data into multiple files such as output_1.sql, output_2.sql...)