Compare commits

..

No commits in common. "main" and "v0.2.0" have entirely different histories.
main ... v0.2.0

View file

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