I'm trying to find out if it's possible to detect if a given string is JavaScript script for the purpose of automatically setting Ace editor more.
'Rules of engagement' would be such that I can have the following:
var x = function(){
alert('hello world');
}
... can this be 'validated' safely as JS? Unfortunately, this would be stored in a DB so I can't rely on a file type extension. In a worst case I might have to mark it as JS content, but for now I'm trying to avoid that.