$ gnpm install cson-parser
A minimalistic CSON parser. Offers:
In addition of pure data it allows for simple arithmetic expressions like addition and multiplication. This allows more readable configuration of numbers, the following is a valid strict CSON file:
cachedData:
refreshIntervalMs: 5 * 60 * 1000
npm install --save cson-parser
CSON = require 'cson-parser'
# This will print { a: '123' }
console.log CSON.parse "a: '123'"
cson-parser
only offers basic parsing and serialization.
But there are some great tools if you want more than that:
fs-cson
, read and write CSON filesCSON
, provides file, coffeescript, javascript handling and a CLIseason
,
atom.io's CSON package.
Includes CLI tool to convert CSON to JSONgrunt-cson
,
converts CSON to JSON as a grunt taskload-grunt-configs
,
loads grunt config from CSON files (among other formats)fetcher
,
a declarative way to download (frontend) libraries, supports CSON configscsonschema
,
parses JSON Schema files written in CSONYou can find more on the npm website.
YAML allows for some pretty complex constructs like anchor and alias, which can behave in unexpected ways, especially with nested objects. CSON is simpler while still offering most of the niceties of YAML.
JSON doesn't offer multi-line strings and is generally a little noisier. Also sometimes it can be nice to have comments in config files.
You don't want data files being able to run arbitrary code.
Even when ran in a proper sandbox, while(true)
is still possible.
Copyright 2013 - present © cnpmjs.org | Home |