/**
* @module escapeHtml
* @description Escapes html special characters in the specified string.
*
* @since 1.0.0
*
* @param {string} unsafe The string to be escaped.
*
* @return {string} Returns a string with all html special characters escaped.
*
* @example
* import { escapeHtml } from "@gravityforms/utils";
*
* function Example() {
* const str = 'my <strong>bold</strong> text will be escaped'
* const escapedString = escapeHtml( str );
* }
*
*/
export default function( unsafe = '' ) {
return String( unsafe )
.replace( /&/g, '&' )
.replace( /</g, '<' )
.replace( />/g, '>' )
.replace( /"/g, '"' )
.replace( /'/g, ''' );
}