New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cson

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cson - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

3

HISTORY.md
# History
## v3.0.1 March 16, 2015
- Fixed stdin support on Node 0.8
## v3.0.0 March 16, 2015

@@ -4,0 +7,0 @@ - Every function now also supports callbacks (2nd or 3rd argument)

@@ -64,2 +64,3 @@ // Generated by CoffeeScript 1.9.1

stdin.setEncoding('utf8');
stdin.resume();
stdin.on('data', function(_data) {

@@ -66,0 +67,0 @@ return data += _data.toString();

2

package.json
{
"title": "CSON",
"name": "cson",
"version": "3.0.0",
"version": "3.0.1",
"description": "CoffeeScript-Object-Notation Parser. Same as JSON but for CoffeeScript objects.",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/bevry/cson",

@@ -133,11 +133,8 @@ <!-- TITLE/ -->

### Via Code
### Via the API
Each method can be executed without a callback like so:
``` javascript
// Prepare
var CSON = require('cson')
var result = null
// Create a CSON string from an Object
result = CSON.stringify({a:{b:'c'}})
result = require('CSON').createCSONString({a:{b:'c'}}, {/* optional options argument */})
if ( result instanceof Error ) {

@@ -148,49 +145,15 @@ console.log(result.stack)

}
```
// Parse a CSON string
result = CSON.parse("a: b: 'c'")
if ( result instanceof Error ) {
console.log(result.stack)
} else {
console.log(result)
}
Or via a callback like so:
// Load a CSON file
result = CSON.load('./config.cson')
if ( result instanceof Error ) {
console.log(result.stack)
} else {
console.log(result)
}
// Require a configuration file
result = CSON.requireFile(filePath, {
cson: true, // support CSON files (default is true)
json: true, // support JSON files (default is true)
coffeescript: false, // support CoffeeScript files (default is false)
javascript: false // support JavaScript files (default is false)
``` javascript
CSON.createCSONString({a:{b:'c'}}, {/* optional options argument */}, function(err,result){
console.log(err, result)
})
if ( result instanceof Error ) {
console.log(result.stack)
} else {
console.log(result)
}
// Parse/Load a configuration file
result = CSON.parseFile(filePath, {
cson: true, // support CSON files (default is true)
json: true, // support JSON files (default is true)
coffeescript: false, // support CoffeeScript files (default is false)
javascript: false // support JavaScript files (default is false)
})
if ( result instanceof Error ) {
console.log(result.stack)
} else {
console.log(result)
}
```
### The API
Executing the method with a callback still executes the method synchronously.
Click the function names for more details on how the specific function operates including the options it supports.
Click the below function names to open more detailed documentation.

@@ -201,15 +164,15 @@

- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#stringify-instance'>
String ::<strong>stringify</strong>(data, opts)
String <strong>CSON.stringify</strong>(data, replacer?, indent?)
</a> <br/> Converts an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> into a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of the desired format If the format option is not specified, we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#createString-instance'>
String ::<strong>createString</strong>(data, opts)
String <strong>CSON.createString</strong>(data, opts?, next?)
</a> <br/> Converts an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> into a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of the desired format If the format option is not specified, we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#createCSONString-instance'>
String ::<strong>createCSONString</strong>(data, opts)
String <strong>CSON.createCSONString</strong>(data, opts?, next?)
</a> <br/> Converts an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> into a CSON <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#createJSONString-instance'>
String ::<strong>createJSONString</strong>(data, opts)
String <strong>CSON.createJSONString</strong>(data, opts?, next?)
</a> <br/> Converts an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> into a JSON <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>

@@ -221,23 +184,23 @@

- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parse-instance'>
Object ::<strong>parse</strong>(data, opts)
Object <strong>CSON.parse</strong>(data, opts?, next?)
</a> <br/> Converts a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseString-instance'>
Object ::<strong>parseString</strong>(data, opts)
Object <strong>CSON.parseString</strong>(data, opts?, next?)
</a> <br/> Converts a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseCSONString-instance'>
Object ::<strong>parseCSONString</strong>(data, opts)
Object <strong>CSON.parseCSONString</strong>(data, opts?, next?)
</a> <br/> Parses a CSON <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseJSONString-instance'>
Object ::<strong>parseJSONString</strong>(data, opts)
Object <strong>CSON.parseJSONString</strong>(data, opts?, next?)
</a> <br/> Parses a JSON <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseCSString-instance'>
Object ::<strong>parseCSString</strong>(data, opts)
Object <strong>CSON.parseCSString</strong>(data, opts?, next?)
</a> <br/> Parses a CoffeeScript <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseJSString-instance'>
Object ::<strong>parseJSString</strong>(data, opts)
Object <strong>CSON.parseJSString</strong>(data, opts?, next?)
</a> <br/> Parses a JavaScript <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>

@@ -248,49 +211,37 @@

- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#load-instance'>
Object ::<strong>load</strong>(data, opts)
Object <strong>CSON.load</strong>(filePath, opts?, next?)
</a> <br/> Parses a file path of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we use the filename to detect what it should be, otherwise we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseFile-instance'>
Object ::<strong>parseFile</strong>(data, opts)
Object <strong>CSON.parseFile</strong>(filePath, opts?, next?)
</a> <br/> Parses a file path of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we use the filename to detect what it should be, otherwise we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseCSONFile-instance'>
Object ::<strong>parseCSONFile</strong>(file, opts)
Object <strong>CSON.parseCSONFile</strong>(filePath, opts?, next?)
</a> <br/> Parses a CSON file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseJSONFile-instance'>
Object ::<strong>parseJSONFile</strong>(file, opts)
Object <strong>CSON.parseJSONFile</strong>(filePath, opts?, next?)
</a> <br/> Parses a JSON file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseCSFile-instance'>
Object ::<strong>parseCSFile</strong>(file, opts)
Object <strong>CSON.parseCSFile</strong>(filePath, opts?, next?)
</a> <br/> Parses a CoffeeScript file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#parseJSFile-instance'>
Object ::<strong>parseJSFile</strong>(file, opts)
</a> <br/> Parses a JAvaScript file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
Object <strong>CSON.parseJSFile</strong>(filePath, opts?, next?)
</a> <br/> Parses a JavaScript file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
### Require Files
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#require-instance'>
Object ::<strong>require</strong>(data, opts)
</a> <br/> Requires or parses a file path of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we use the filename to detect what it should be, otherwise we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#requireFile-instance'>
Object ::<strong>requireFile</strong>(data, opts)
Object <strong>CSON.requireFile</strong>(filePath, opts?, next?)
</a> <br/> Requires or parses a file path of the desired format into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> If the format option is not specified, we use the filename to detect what it should be, otherwise we default to CSON
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#requireCSONFile-instance'>
Object ::<strong>requireCSONFile</strong>(file, opts)
</a> <br/> Parses a CSON file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#requireJSONFile-instance'>
Object ::<strong>requireJSONFile</strong>(file, opts)
</a> <br/> Parses a JSON file into an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#requireCSFile-instance'>
Object ::<strong>requireCSFile</strong>(file, opts)
Object <strong>CSON.requireCSFile</strong>(filePath, opts?, next?)
</a> <br/> Requires a CoffeeScript file and returns the result <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>
- <a href='http://rawgit.com/bevry/cson/master/docs/classes/CSON.html#requireJSFile-instance'>
Object ::<strong>requireJSFile</strong>(file, opts)
Object <strong>CSON.requireJSFile</strong>(filePath, opts?, next?)
</a> <br/> Requires a JavaScript file and returns the result <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a>

@@ -297,0 +248,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc