Compare commits

...

1 commit
v0.2.0 ... main

Author SHA1 Message Date
be268f2f76 Changed ScriptEscape from []byte to string 2023-08-23 11:11:43 +02:00

View file

@ -5,11 +5,11 @@ import (
"regexp" "regexp"
) )
func ScriptEscape(source []byte) (escaped []byte) { func ScriptEscape(source string) (escaped string) {
rxp2 := regexp.MustCompile("([\"\\\\$])") rxp2 := regexp.MustCompile("([\"\\\\$])")
source = rxp2.ReplaceAll(source, []byte("\\$1")) source = rxp2.ReplaceAllString(source, "\\$1")
rxp := regexp.MustCompile("\\r?\\n") rxp := regexp.MustCompile("\\r?\\n")
escaped = rxp.ReplaceAll(source, []byte("\\r\\\r\n \\n")) escaped = rxp.ReplaceAllString(source, "\\r\\\r\n \\n")
return return
} }