Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var stringify = Stringify()
stringify.replacer = function () {}
stringify.space = 2
stringify.opener = '['
stringify.seperator = ','
stringify.separator = ','
stringify.closer = ']'
stringify.stringifier = JSON.stringify
```
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ function Stringify(options) {

// Array Deliminator and Stringifier defaults
var opener = options && options.opener ? options.opener : '[\n'
var seperator = options && options.seperator ? options.seperator : '\n,\n'
var separator = options && options.separator ? options.separator : '\n,\n'
var closer = options && options.closer ? options.closer : '\n]\n'
var stringifier = options && options.stringifier ? options.stringifier : stringify

// Array Deliminators and Stringifier
this.opener = new Buffer(opener, 'utf8')
this.seperator = new Buffer(seperator, 'utf8')
this.separator = new Buffer(separator, 'utf8')
this.closer = new Buffer(closer, 'utf8')
this.stringifier = stringifier
}
Expand All @@ -47,7 +47,7 @@ Stringify.prototype.space = 0

Stringify.prototype._transform = function (doc, enc, cb) {
if (this.started) {
this.push(this.seperator)
this.push(this.separator)
} else {
this.push(this.opener)
this.started = true
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ describe('Streamify()', function () {
stream.end(obj)
})

it('should allow custom seperators', function (done) {
it('should allow custom separators', function (done) {
var stream = new PassThrough({
objectMode: true
})

var stringify = Stringify({seperator: ' , '})
var stringify = Stringify({separator: ' , '})

stream
.pipe(stringify)
Expand Down