CSON-backward-compatible utilities
npm install @inkdropapp/yeason##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement
  
Read and write YAML/CSON/JSON files seamlessly.
It does not require cson-parser.
``sh`
npm install @inkdropapp/yeason
- Clone the repository
- Run npm installgrunt
- Run to compile the CoffeeScript codegrunt test
- Run to run the specs
This module comes with a csonc executable that allows you to compile a CSON
file to JSON.
To use:
`sh`
npm install -g season
echo "this: 'is cson'" > file.cson
csonc file.cson --output file.json
cat file.json
{
"this": "is cson"
}
`coffeescript`
CSON = require 'season'
Set the cache directory to use for storing compiled CSON files.
cacheDirectory - Root directory path for storing compiled CSON.
Convert the object to a CSON string.
object - The object to convert to CSON.
Returns the CSON string representation of the given object.
Read the CSON or JSON object at the given path and return it to the callback
once it is read and parsed.
objectPath - The string path to a JSON or CSON object file.
callback - The function to call with the error or object once the path
is read and parsed.
Synchronous version of CSON.readFile(objectPath, callback).
Returns the object read from the path or throws an error if reading fails.
Write the object to the given path as either JSON or CSON depending on the
path's extension.
objectPath - The string path to a JSON or CSON object file.
object - The object to convert to a string and write to the path.
callback - The function to with an error object on failures.
Synchronous version of CSON.writeFile(objectPath, object, callback)
Is the given path a valid object path?
Returns true if the path has a .json or .cson file extension, false
otherwise.
Resolve the path to an existent file that has a .json or .cson extension.
objectPath - The string path to a JSON or CSON object file with or without
an extension.
Returns the path to an existent CSON or JSON file or null` if none found.