MCPcopy Create free account
hub / github.com/driangle/taskmd / isAlphanumericID

Function isAlphanumericID

sdk/go/parser/markdown.go:261–274  ·  view source on GitHub ↗

isAlphanumericID returns true if s is 3-8 lowercase alphanumeric chars with at least one digit. This avoids false-positives on English words like "readme".

(s string)

Source from the content-addressed store, hash-verified

259// isAlphanumericID returns true if s is 3-8 lowercase alphanumeric chars with at least one digit.
260// This avoids false-positives on English words like "readme".
261func isAlphanumericID(s string) bool {
262 if len(s) < 3 || len(s) > 8 {
263 return false
264 }
265 hasDigit := false
266 for _, c := range s {
267 if c >= '0' && c <= '9' {
268 hasDigit = true
269 } else if c < 'a' || c > 'z' {
270 return false
271 }
272 }
273 return hasDigit
274}
275
276// extractFrontmatter splits content into frontmatter and body
277func extractFrontmatter(content []byte) (frontmatter []byte, body string, err error) {

Callers 2

splitFilenameIDFunction · 0.85
TestIsAlphanumericIDFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsAlphanumericIDFunction · 0.68