address review comments

This commit is contained in:
nightwing 2015-04-20 18:25:32 +04:00
commit 89b9a8ac72
2 changed files with 9 additions and 7 deletions

View file

@ -12,11 +12,13 @@ exports.parsePlist = function(xmlOrJSON, callback) {
plist.parseString(xmlOrJSON, function(_, result) {
json = result[0];
});
} else try {
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
json = JSON.parse(xmlOrJSON)
} catch(e) {
json = cson.parse(xmlOrJSON);
} else {
try {
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
json = JSON.parse(xmlOrJSON)
} catch(e) {
json = cson.parse(xmlOrJSON);
}
}
callback && callback(json);
return json;