初始化
This commit is contained in:
18
node_modules/xml-js/lib/json2xml.js
generated
vendored
Normal file
18
node_modules/xml-js/lib/json2xml.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var js2xml = require('./js2xml.js');
|
||||
|
||||
module.exports = function (json, options) {
|
||||
if (json instanceof Buffer) {
|
||||
json = json.toString();
|
||||
}
|
||||
var js = null;
|
||||
if (typeof (json) === 'string') {
|
||||
try {
|
||||
js = JSON.parse(json);
|
||||
} catch (e) {
|
||||
throw new Error('The JSON structure is invalid');
|
||||
}
|
||||
} else {
|
||||
js = json;
|
||||
}
|
||||
return js2xml(js, options);
|
||||
};
|
||||
Reference in New Issue
Block a user