diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 0d751775002..65a48566c4c 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -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. *