MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / match

Method match

lib/web/CodeMirror/src/util/StringStream.js:59–73  ·  view source on GitHub ↗
(pattern, consume, caseInsensitive)

Source from the content-addressed store, hash-verified

57 (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
58 }
59 match(pattern, consume, caseInsensitive) {
60 if (typeof pattern == "string") {
61 let cased = str => caseInsensitive ? str.toLowerCase() : str
62 let substr = this.string.substr(this.pos, pattern.length)
63 if (cased(substr) == cased(pattern)) {
64 if (consume !== false) this.pos += pattern.length
65 return true
66 }
67 } else {
68 let match = this.string.slice(this.pos).match(pattern)
69 if (match && match.index > 0) return null
70 if (match && consume !== false) this.pos += match[0].length
71 return match
72 }
73 }
74 current(){return this.string.slice(this.start, this.pos)}
75 hideFirstChars(n, inner) {
76 this.lineStart += n

Callers 15

VimFunction · 0.95
unescapeRegexReplaceFunction · 0.95
parseArgsFunction · 0.95
formatArrayFunction · 0.45
formatPropertyFunction · 0.45
wordsFunction · 0.45
jshint.jsFile · 0.45
polyfill.jsFile · 0.45
iFunction · 0.45
GFunction · 0.45
rcFunction · 0.45

Calls 1

casedFunction · 0.85

Tested by

no test coverage detected