MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / filter

Method filter

Extension/src/Utility/Process/streams.ts:74–93  ·  view source on GitHub ↗
(expression: string | RegExp)

Source from the content-addressed store, hash-verified

72 }
73
74 async filter(expression: string | RegExp) {
75 const result = new Array<string>();
76 const stream = this.tee();
77 if (expression instanceof RegExp) {
78 for await (const line of stream) {
79 const check = expression.exec(line);
80 if (check) {
81 result.push(check[1] || check[0]);
82 }
83 }
84 return result;
85 }
86 for await (const line of stream) {
87 if (line.includes(expression)) {
88 result.push(line);
89 }
90 }
91
92 return result;
93 }
94
95 /**
96 * Splits the iterator into two, and advances the new iterator to the line that matches the expression.

Callers 15

nodeCallbackFunction · 0.45
markerFunction · 0.45
process.test.tsFile · 0.45
showActiveHandlesFunction · 0.45
findPowerShellFunction · 0.45
caseNormalizeConfigPropsFunction · 0.45
extractHostsFunction · 0.45
getHostsFromHostConfigFunction · 0.45
lastNonemptyLineFunction · 0.45
scanMethod · 0.45

Calls 2

teeMethod · 0.95
pushMethod · 0.80

Tested by 1

markerFunction · 0.36