From 30ced148c3e91bbf0988ba5788d2500e20ca3469 Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Mon, 2 Nov 2015 09:03:32 +0530 Subject: [PATCH] Fix: dylang/node-xml#21 Streams should end properly --- lib/xml.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/xml.js b/lib/xml.js index b10df62..01a5654 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -50,11 +50,12 @@ function xml(input, options) { function end() { if (stream) { var data = output; - delay(function () { stream.emit('data', data) }); - - stream.emit('end'); - stream.readable = false; - stream.emit('close'); + delay(function () { + stream.emit('data', data); + stream.emit('end'); + stream.readable = false; + stream.emit('close'); + }); } } @@ -278,4 +279,4 @@ function attribute(key, value) { } module.exports = xml; -module.exports.element = module.exports.Element = element; \ No newline at end of file +module.exports.element = module.exports.Element = element;