Buckets:
| var helper = require('./options-helper'); | |
| var xml2js = require('./xml2js'); | |
| function validateOptions (userOptions) { | |
| var options = helper.copyOptions(userOptions); | |
| helper.ensureSpacesExists(options); | |
| return options; | |
| } | |
| module.exports = function(xml, userOptions) { | |
| var options, js, json, parentKey; | |
| options = validateOptions(userOptions); | |
| js = xml2js(xml, options); | |
| parentKey = 'compact' in options && options.compact ? '_parent' : 'parent'; | |
| // parentKey = ptions.compact ? '_parent' : 'parent'; // consider this | |
| if ('addParent' in options && options.addParent) { | |
| json = JSON.stringify(js, function (k, v) { return k === parentKey? '_' : v; }, options.spaces); | |
| } else { | |
| json = JSON.stringify(js, null, options.spaces); | |
| } | |
| return json.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029'); | |
| }; | |
Xet Storage Details
- Size:
- 852 Bytes
- Xet hash:
- 7eaf36d4c8cd078812b714a116efc7c5e3af8b2d8ea7bd1beb6fee4c64dec90b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.