MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / ForEachLine

Function ForEachLine

commit/parser.go:101–108  ·  view source on GitHub ↗

ForEachLine iterates over lines in s without their LF or CRLF endings. Iteration stops if fn returns false.

(s string, fn func(line string) bool)

Source from the content-addressed store, hash-verified

99// ForEachLine iterates over lines in s without their LF or CRLF endings.
100// Iteration stops if fn returns false.
101func ForEachLine(s string, fn func(line string) bool) {
102 it := syntax.Lines(s)
103 for line, ok := it.Next(); ok; line, ok = it.Next() {
104 if !fn(s[line.Content.Start:line.Content.End]) {
105 return
106 }
107 }
108}
109
110// DiagnosticPosition returns the 1-based line and column for err in msg when
111// err carries a byte offset, or false otherwise.

Callers 2

validateMaxLineLengthFunction · 0.92
TestCommitHelpersFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestCommitHelpersFunction · 0.74