Skip to content

Commit

Permalink
Merge pull request #91 from node-xmpp/no-json-2
Browse files Browse the repository at this point in the history
remove Element.toJSON
  • Loading branch information
sonnyp committed Apr 4, 2016
2 parents 6ccfc52 + ca43c42 commit a1fc70c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion benchmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readdir(__dirname).forEach(function (file) {
console.log(event.target.toString())
})
.on('complete', function () {
console.log('Fastest is ' + this.filter('fastest').map('name'))
console.log('Fastest is "' + this.filter('fastest').map('name') + '"')
})
.run({'async': false})
console.log('\n')
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/parsers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict'

/*
* benchmark the parsing speed of the supported backends
* difference with parse.js benchmark is that this doesn't use ltx at all
*/

var benchmark = require('benchmark')
var node_xml = require('node-xml')
var libxml = require('libxmljs')
Expand Down
10 changes: 0 additions & 10 deletions lib/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,6 @@ Element.prototype.toString = function () {
return s
}

Element.prototype.toJSON = function () {
return {
name: this.name,
attrs: this.attrs,
children: this.children.map(function (child) {
return child && child.toJSON ? child.toJSON() : child
})
}
}

Element.prototype._addChildren = function (writer) {
writer('>')
for (var i = 0; i < this.children.length; i++) {
Expand Down
1 change: 0 additions & 1 deletion lib/parsers/sax-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var SaxSaxjs = module.exports = function SaxSaxjs () {
this.parser.onerror = function (e) {
that.emit('error', e)
}
// TODO: other events, esp. entityDecl (billion laughs!)
}

inherits(SaxSaxjs, EventEmitter)
Expand Down
10 changes: 0 additions & 10 deletions test/element-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ vows.describe('Element').addBatch({
'serialize with integer text': function () {
var e = new Element('e').t(1000)
assert.equal(e.getText(), 1000)
},
'serialize to json': function () {
var e = new Element('e', { foo: 23, bar: 0, nil: null }).c('f').t(1000).up()
assert.deepEqual(e.toJSON(), {
name: 'e',
attrs: { foo: 23, bar: 0, nil: null },
children: [
{ name: 'f', attrs: {}, children: [1000] }
]
})
}
},
'remove': {
Expand Down

0 comments on commit a1fc70c

Please sign in to comment.