Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

gulp-cson

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-cson - npm Package Compare versions

Comparing version
0.3.1
to
0.4.0
+10
test/expected/normal-indent.json
{
"abc": [
"a",
"b",
"c"
],
"a": {
"b": "c"
}
}
+2
-1

@@ -8,2 +8,3 @@ map = require 'map-stream'

options = {} unless options
indent = if typeof options.indent == 'string' or options.indent == null then options.indent else ' '

@@ -13,3 +14,3 @@ gcson = (file, cb) ->

return cb json if json instanceof Error
file.contents = new Buffer JSON.stringify json
file.contents = new Buffer JSON.stringify json, null, indent
file.path = rext file.path, '.json'

@@ -16,0 +17,0 @@

{
"name": "gulp-cson",
"description": "Parse cson with gulp",
"version": "0.3.1",
"version": "0.4.0",
"homepage": "http://github.com/stevelacy/gulp-cson",

@@ -6,0 +6,0 @@ "repository": {

@@ -34,2 +34,3 @@ #gulp-cson

#### Default indentation (2 spaces)
```coffee-script

@@ -47,2 +48,32 @@ gulp = require 'gulp'

#### No indentation
```coffee-script
gulp = require 'gulp'
gcson = require 'gulp-cson'
gulp.task 'cson', ->
gulp.src './normal.cson'
.pipe gcson(
indent: null
)
.pipe gulp.dest './'
gulp.task 'default', ['cson']
```
#### With custom indentation
```coffee
gulp = require 'gulp'
gcson = require 'gulp-cson'
gulp.task 'cson', ->
gulp.src './normal.cson'
.pipe gcson(
indent: '\t'
)
.pipe gulp.dest './'
gulp.task 'default', ['cson']
```
####You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-cson/tree/master/examples)

@@ -49,0 +80,0 @@

@@ -11,3 +11,5 @@ fs = require 'fs'

it 'should parse cson to json', (done) ->
myFunction = gcson()
myFunction = gcson(
indent: null
)
fakeFile = new gutil.File

@@ -22,3 +24,3 @@ base: 'test/fixtures'

should.exist newFile.contents
should.equal newFile.path, 'test/fixtures/normal.json'
should.equal newFile.path.replace(/\\/g, '/'), 'test/fixtures/normal.json'
String(newFile.contents).should.equal String fs.readFileSync path.join __dirname, '/expected/normal.json'

@@ -29,2 +31,19 @@ done()

it 'should parse cson to json with indent', (done) ->
myFunction = gcson()
fakeFile = new gutil.File
base: 'test/fixtures'
cwd: 'test/'
path: 'test/fixtures/normal.cson'
contents: fs.readFileSync path.join __dirname, '/fixtures/normal.cson'
myFunction.once 'data', (newFile) ->
should.exist newFile
should.exist newFile.contents
should.equal newFile.path.replace(/\\/g, '/'), 'test/fixtures/normal.json'
String(newFile.contents).should.equal String fs.readFileSync path.join __dirname, '/expected/normal-indent.json'
done()
myFunction.write fakeFile
it 'should return error on error', (done) ->

@@ -31,0 +50,0 @@ myFunction = gcson()