Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	jsoneditor.js
	jsoneditor.map
	jsoneditor.min.js
	src/js/util.js
This commit is contained in:
jos 2015-02-27 22:21:06 +01:00
commit 2c9b7e9c7b
1 changed files with 10 additions and 0 deletions

View File

@ -68,6 +68,16 @@ exports.sanitize = function (jsString) {
return $1 + '"' + $2 + '"' + $3; return $1 + '"' + $2 + '"' + $3;
}); });
jsonString = jsonString.replace(/\/\*(.|[\r\n])*?\*\//g,'');//Remove all code comments
//If JSON starts with a function (Carachters/digist/"_-"), remove this function.
//This is usefull for "stripping" JSONP objects to become JSON
//For example: function_12321321 ( [{"a":"b"}] ); => [{"a":"b"}]
var match = jsonString.match(/^\s*[\dA-z_$]+\s*\(([\s\S]*)\)\s*;?\s*$/);
if (match) {
var jsonString = match[1];
}
return jsonString; return jsonString;
}; };