mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 12:31:54 +08:00
Perf: speed up build
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* @param {string} line
|
||||
*/
|
||||
module.exports.processLine = (line) => {
|
||||
const processLine = (line) => {
|
||||
if (!line) {
|
||||
return null;
|
||||
}
|
||||
@@ -30,3 +30,19 @@ module.exports.processLine = (line) => {
|
||||
|
||||
return trimmed;
|
||||
};
|
||||
module.exports.processLine = processLine;
|
||||
|
||||
/**
|
||||
* @param {import('readline').ReadLine} rl
|
||||
*/
|
||||
module.exports.processLineFromReadline = async (rl) => {
|
||||
/** @type {string[]} */
|
||||
const res = [];
|
||||
for await (const line of rl) {
|
||||
const l = processLine(line);
|
||||
if (l) {
|
||||
res.push(l);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user