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

Function IsValidIdentifier

internal/scanner/scanner.go:2224–2234  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

2222}
2223
2224func IsValidIdentifier(s string) bool {
2225 if len(s) == 0 {
2226 return false
2227 }
2228 for i, ch := range s {
2229 if i == 0 && !IsIdentifierStart(ch) || i != 0 && !IsIdentifierPart(ch) {
2230 return false
2231 }
2232 }
2233 return true
2234}
2235
2236// Section 6.1.4
2237func isWordCharacter(ch rune) bool {

Callers 3

reparseJSDocSignatureMethod · 0.92

Calls 3

lenFunction · 0.85
IsIdentifierStartFunction · 0.85
IsIdentifierPartFunction · 0.85

Tested by

no test coverage detected