cson-light
CoffeeScript Object Notation
Last updated 5 years ago by nim579 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cson-light 
SYNC missed versions from official npm registry.

CSON

CoffeeScript Object Notation

Use

Install as npm module

$ npm install cson-light

Use in scripts (Node.js)

var CSON = require('cson-light');

Use

CSON.parse(string);

Methods

readFile(path)

Converts CSON file in JavaScript object.

Parameters

  • path — Path to CSON file
CSON.readFile("./data.cson") //return parsed CSON file as JavaScript object

parse(string)

Parameters

  • object — Stringifyed CSON object
CSON.parse('test: "data", "foo": "bar"\nsec: 1') //return { "test": "data", "foo": "bar", "sec": 1 }

stringify(object [, spaces])

Convert JavaScript object to CSON

Parameters

  • object — JavaScript object
  • spaces — Causes the resulting string to be pretty-printed.
CSON.stringify({ "test": 'data', "foo": "bar", "sec": 1 }) //return 'test: "data"\nfoo: "bar"\nsec: 1'
CSON.stringify({ "test": 'data', "foo": "bar", "obj": {"foo": [1,2]} }, 4) //return 'test: "data"\nfoo: "bar"\nobj:\n  foo: [\n    1\n    2\n  ]'

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

2 Versions

  • 1.0.0                                ...           5 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |