Writing JSON in coffee-script format
npm install coffee-bean
|2||downloads in the last week|
|7||downloads in the last month|
|Version||0.2.0 last updated 4 months ago|
|Keywords||package.json, configuration, coffee, bean, script|
|Dependencies||optimist, coffee-script, chai, underscore|
An utility to generate JSON file from a coffee-script.
$ npm install -g coffee-bean
$ bean [-s file.bean|file.coffee] # file.json will be generated
Writing JSON files manually is tedious and error prone
- Forgetting to add commas between items
- Adding commas to the last item of an error or an object
- Forgetting to quote the keys
- Cannot add comments
Coffeescript's object notation is much cleaner by comparison.
A bean file is basically a coffeescript file that returns a JSON object. The object will then be formatted according to JSON rules. You can perform any legal coffeescript logic as long as the end result is a JSON object.
This is best used for managing configuration files, such as package.json. Just take a look at this module's package.bean for inspiration.
Released under MIT License.