Sanitizes a string by removing script tags and returning a safe string to be outputted on a page.

Parameters:
NameTypeDescription
unsafestring

The string to be escaped/sanitized.

Since
  • 1.0.0
Returns:

Returns a string with all script tags removed.

Type: 
string
Example
import { escapeScripts } from "@gravityforms/utils";

function Example() {
  const unsafeString = 'Some text <script>alert( "I am unsafe" );</script> that is not safe';
	 const safeString = escapeScripts( unsafeString );
}