const escapeStringRegexp = ( str ) : string => { if ( typeof str !== 'string' ) { throw new TypeError ( 'Expected a string' ) ; } return str . replace ( /[|\\{}()[\]^$+*?.]/g , '\\$&' ) . replace ( /-/g , '\\x2d' ) ; } ; export default escapeStringRegexp ;