mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-07 00:56:53 +02:00
* Added remote type reference resolver * Added support of XPath query selector * Added CDP e2e testss covering XPath integration * Added additional CDP e2e tests covering XPath integration * Added type check to QuerySelector casting function * Fixed XPath e2e tests * Fixed vuln issue * Added support of XPath selectors to http driver * Added e2e tests for XPAth
36 lines
501 B
Go
36 lines
501 B
Go
package dom
|
|
|
|
import (
|
|
"bytes"
|
|
"regexp"
|
|
"strings"
|
|
)
|
|
|
|
var camelMatcher = regexp.MustCompile("[A-Za-z0-9]+")
|
|
|
|
func toCamelCase(input string) string {
|
|
var buf bytes.Buffer
|
|
|
|
matched := camelMatcher.FindAllString(input, -1)
|
|
|
|
if matched == nil {
|
|
return ""
|
|
}
|
|
|
|
for i, match := range matched {
|
|
res := match
|
|
|
|
if i > 0 {
|
|
if len(match) > 1 {
|
|
res = strings.ToUpper(match[0:1]) + match[1:]
|
|
} else {
|
|
res = strings.ToUpper(match)
|
|
}
|
|
}
|
|
|
|
buf.WriteString(res)
|
|
}
|
|
|
|
return buf.String()
|
|
}
|