Please create a parsing tool that takes the example config file (provided below) and turns it into a usable object in the language of your choice (hash, JSON object, associative array, class, etc). The instructions for this are below. Please let us know if you have any questions!
-
Do not use existing "complete" configuration parsing libraries/functions, we want to see how you would write the code to do this.
-
Use of core and stdlib functions/objects such as string manipulation, regular expressions, etc is ok.
-
We should be able to get the values of the config parameters in code, via their name. How this is done specifically is up to you.
-
Boolean-like config values (on/off, yes/no, true/false) should return real booleans: true/false.
-
Numeric config values should return real numerics: integers, doubles, etc
-
Ignore or error out on invalid config lines, your choice.
-
Please include a short example usage of your code so we can see how you call it/etc.
-
Push your work to a public git repository (github, bitbucket, etc) and send us the link.
In the terminal run
node parseTool.js
Locate and open config.txt file. Make changes and save.