comma-first
v0.0.1
Published
Format objects into a comma-first JSON string
Downloads
2
Readme
comma-first
Create a 2-space indented, comma-first JSON string of an object
Install
With npm
npm install comma-first
Usage
var commaFirst = require('comma-first')
var someObject = {
array: [1, 2, 3, 4, 5]
, obj: {
some: 'thing'
, dark: 'side'
}
, num: 20
}
console.log(commaFirst(someObject))
{
"array": [
1
, 2
, 3
, 4
, 5
]
, "obj": {
"some": "thing"
, "dark": "side"
}
, "num": 20
}
File rewrite example
var commaFirst = require('comma-first')
, fs = require('fs')
, pkg = require('./package.json')
var out = commaFirst(pkg)
fs.writeFileSync(__dirname + '/package.json', out, 'utf8')
License
(The MIT License)