Skip to content

Commit 426c0c1

Browse files
authored
Merge pull request #36 from gltjk/patch-1
Increase resilience to generating large workbooks
2 parents 779752b + 60e33a5 commit 426c0c1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/utils/xml-stream.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,19 @@ const OPEN_ANGLE = '<';
77
const CLOSE_ANGLE = '>';
88
const OPEN_ANGLE_SLASH = '</';
99
const CLOSE_SLASH_ANGLE = '/>';
10-
const EQUALS_QUOTE = '="';
11-
const QUOTE = '"';
12-
const SPACE = ' ';
1310

1411
function pushAttribute(xml, name, value) {
15-
xml.push(SPACE);
16-
xml.push(name);
17-
xml.push(EQUALS_QUOTE);
18-
xml.push(utils.xmlEncode(value.toString()));
19-
xml.push(QUOTE);
12+
xml.push(` ${name}="${utils.xmlEncode(value.toString())}"`);
2013
}
2114
function pushAttributes(xml, attributes) {
2215
if (attributes) {
16+
const tmp = [];
2317
_.each(attributes, (value, name) => {
2418
if (value !== undefined) {
25-
pushAttribute(xml, name, value);
19+
pushAttribute(tmp, name, value);
2620
}
2721
});
22+
xml.push(tmp.join(""));
2823
}
2924
}
3025

0 commit comments

Comments
 (0)