MCPcopy Index your code
hub / github.com/nodejs/node / breakPatternIntoTextChunks

Function breakPatternIntoTextChunks

test/fixtures/snapshot/typescript.js:142702–142725  ·  view source on GitHub ↗
(pattern)

Source from the content-addressed store, hash-verified

142700 return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 /* CharacterCodes._ */ || ch === 36 /* CharacterCodes.$ */;
142701 }
142702 function breakPatternIntoTextChunks(pattern) {
142703 var result = [];
142704 var wordStart = 0;
142705 var wordLength = 0;
142706 for (var i = 0; i < pattern.length; i++) {
142707 var ch = pattern.charCodeAt(i);
142708 if (isWordChar(ch)) {
142709 if (wordLength === 0) {
142710 wordStart = i;
142711 }
142712 wordLength++;
142713 }
142714 else {
142715 if (wordLength > 0) {
142716 result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
142717 wordLength = 0;
142718 }
142719 }
142720 }
142721 if (wordLength > 0) {
142722 result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
142723 }
142724 return result;
142725 }
142726 function createTextChunk(text) {
142727 var textLowerCase = text.toLowerCase();
142728 return {

Callers 1

createSegmentFunction · 0.85

Calls 3

isWordCharFunction · 0.85
createTextChunkFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…