alykoshin / require-dir-all

Yet another Node.js helper to require all files in directory
MIT License
9 stars 1 forks source link

cson support #2

Open dkebler opened 8 years ago

dkebler commented 8 years ago

can use the map feature to parse any file type to an object.?

In particular I need to create an object from a single directory of cson files.

I already have a few line single file function using https://github.com/groupon/cson-parser and was going to write something with glob-fs for a whole directory but if your package will do it so be it.

if so a hint or a few lines of code would be helpful.

alykoshin commented 8 years ago

sorry for the delay with the answer. require-dir-all module is based on require() function. So, it is not able (and not intended) to work with any type of files. I have another module, config-dir-all, but at the moment it also does not suits your task.

I think, here is what you need: https://github.com/lorenwest/node-config (not used it though, but it is very popular) Specifically, this section describes the solution for your needs: https://github.com/lorenwest/node-config/wiki/Configuration-Files#coffeescript-object-notation---cson