1 | var js2xml = require('./js2xml.js');
|
2 |
|
3 | module.exports = function (json, options) {
|
4 | ;
|
5 | if (json instanceof Buffer) {
|
6 | json = json.toString();
|
7 | }
|
8 | var js = null;
|
9 | if (typeof (json) === 'string') {
|
10 | try {
|
11 | js = JSON.parse(json);
|
12 | } catch (e) {
|
13 | throw new Error("The JSON structure is invalid");
|
14 | }
|
15 | } else {
|
16 | js = json;
|
17 | }
|
18 | return js2xml(js, options);
|
19 | }; |
\ | No newline at end of file |