MCPcopy Create free account
hub / github.com/microsoft/typescript-go / GetIdentifierToken

Function GetIdentifierToken

internal/scanner/scanner.go:2214–2222  ·  view source on GitHub ↗
(str string)

Source from the content-addressed store, hash-verified

2212}
2213
2214func GetIdentifierToken(str string) ast.Kind {
2215 if len(str) >= 2 && len(str) <= 12 && str[0] >= 'a' && str[0] <= 'z' {
2216 keyword := textToKeyword[str]
2217 if keyword != ast.KindUnknown {
2218 return keyword
2219 }
2220 }
2221 return ast.KindIdentifier
2222}
2223
2224func IsValidIdentifier(s string) bool {
2225 if len(s) == 0 {

Callers 4

ScanMethod · 0.85
ScanJsxIdentifierMethod · 0.85
ScanJSDocTokenMethod · 0.85

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected