Skip to content
This repository was archived by the owner on Jan 7, 2021. It is now read-only.

Commit e4c71b3

Browse files
committed
convert all leading tabs to spaces
1 parent 6bef414 commit e4c71b3

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

lib/json2xml.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ module.exports = function toXml(json, xml) {
2323
var key = keys[i], value = obj[key], isArray = Array.isArray(value);
2424
var type = typeof(value);
2525
if (type == 'string' || type == 'number' || type == 'boolean' || isArray) {
26-
var it = isArray ? value : [value];
26+
var it = isArray ? value : [value];
2727

28-
it.forEach(function(subVal) {
29-
if (typeof(subVal) != 'object') {
30-
if (key == '$t') {
31-
xml += subVal;
32-
} else {
33-
xml = xml.replace(/>$/, '');
34-
xml += ' ' + key + '="' + subVal + '">';
35-
}
36-
}
37-
})
28+
it.forEach(function(subVal) {
29+
if (typeof(subVal) != 'object') {
30+
if (key == '$t') {
31+
xml += subVal;
32+
} else {
33+
xml = xml.replace(/>$/, '');
34+
xml += ' ' + key + '="' + subVal + '">';
35+
}
36+
}
37+
})
3838
}
3939
}
4040

@@ -46,13 +46,13 @@ module.exports = function toXml(json, xml) {
4646
var elems = obj[key];
4747
var l = elems.length;
4848
for (var j = 0; j < l; j++) {
49-
var elem = elems[j];
49+
var elem = elems[j];
5050

51-
if (typeof(elem) == 'object') {
52-
xml += '<' + key + '>';
53-
xml = toXml(elem, xml);
54-
xml += '</' + key + '>';
55-
}
51+
if (typeof(elem) == 'object') {
52+
xml += '<' + key + '>';
53+
xml = toXml(elem, xml);
54+
xml += '</' + key + '>';
55+
}
5656
}
5757
} else if (typeof(obj[key]) == 'object') {
5858
xml += '<' + key + '>';

0 commit comments

Comments
 (0)