Refactor build scripts

This commit is contained in:
SukkaW
2023-07-13 22:31:27 +08:00
parent b43c1628d6
commit 685427472b
6 changed files with 35 additions and 36 deletions

32
Build/lib/process-line.js Normal file
View File

@@ -0,0 +1,32 @@
/* eslint-disable camelcase -- cache index access */
/**
* If line is commented out or empty, return null.
* Otherwise, return trimmed line.
*
* @param {string} line
*/
module.exports.processLine = (line) => {
if (!line) {
return null;
}
const line_0 = line[0];
if (
line_0 === '#'
|| line_0 === ' '
|| line_0 === '\r'
|| line_0 === '\n'
|| line_0 === '!'
) {
return null;
}
const trimmed = line.trim();
if (trimmed === '') {
return null;
}
return trimmed;
};