Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	jsoneditor.js
	jsoneditor.map
	jsoneditor.min.js
	src/js/util.js
  • Loading branch information
josdejong committed Feb 27, 2015
2 parents 629ed49 + 1a5ea41 commit 2c9b7e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ exports.sanitize = function (jsString) {
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;
};

Expand Down

0 comments on commit 2c9b7e9

Please sign in to comment.