This utility method exist in OmniFaces 2.0, but it was improved in OmniFaces 2.1.
[OmniFaces utilities] The
String stringToEscape = "...";
String escapedJS = Utils.escapeJS(stringToEscape, false);
OmniFaces uses this method in the utilities from JSON class.