Skip to content

Commit

Permalink
fix(build): Restore erroneously-deleted filter function
Browse files Browse the repository at this point in the history
This was deleted in PR google#7406 as it was mainly being used to
filter core/ vs. test/mocha/ deps into separate deps files -
but it turns out also to be used for filtering error
messages too.  Oops.
  • Loading branch information
cpcallen committed Aug 20, 2023
1 parent a38340b commit 4c65005
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/gulpfiles/build_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ function buildDeps() {
/** Maximum buffer size, in bytes for child process stdout/stderr. */
const MAX_BUFFER_SIZE = 10 * 1024 * 1024;

/**
* Filter a string to extract lines containing (or not containing) the
* specified target string.
*
* @param {string} text Text to filter.
* @param {string} target String to search for.
* @param {boolean?} exclude If true, extract only non-matching lines.
* @returns {string} Filtered text.
*/
function filter(text, target, exclude) {
return text.split('\n')
.filter((line) => Boolean(line.match(target)) !== Boolean(exclude))
.join('\n');
}

/**
* Log unexpected diagnostics, after removing expected warnings.
*
Expand Down

0 comments on commit 4c65005

Please sign in to comment.