Comparing version 0.5.4 to 0.5.5
@@ -182,2 +182,4 @@ // wrapper for non-node envs | ||
this._decoder = null; | ||
streamWraps.forEach(function (ev) { | ||
@@ -203,2 +205,12 @@ Object.defineProperty(me, "on" + ev, { | ||
SAXStream.prototype.write = function (data) { | ||
if (typeof Buffer === 'function' && | ||
typeof Buffer.isBuffer === 'function' && | ||
Buffer.isBuffer(data)) { | ||
if (!this._decoder) { | ||
var SD = require('string_decoder').StringDecoder | ||
this._decoder = new SD('utf8') | ||
} | ||
data = this._decoder.write(data); | ||
} | ||
this._parser.write(data.toString()) | ||
@@ -210,3 +222,4 @@ this.emit("data", data) | ||
SAXStream.prototype.end = function (chunk) { | ||
if (chunk && chunk.length) this._parser.write(chunk.toString()) | ||
if (chunk && chunk.length) this.write(chunk) | ||
else if (this.leftovers) this._parser.write(this.leftovers.toString()) | ||
this._parser.end() | ||
@@ -213,0 +226,0 @@ return true |
@@ -5,3 +5,3 @@ { | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"main": "lib/sax.js", | ||
@@ -8,0 +8,0 @@ "license": "BSD", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
463678
57
2388