build.js: prefer startsWith over regex with a caret

Found by eslint-plugin-unicorn.
This commit is contained in:
Jelle van der Waa 2024-09-23 11:39:11 +02:00
parent 6089ae39d9
commit e72a02a405

View file

@ -57,8 +57,7 @@ function watch_dirs(dir, on_change) {
const callback = (ev, dir, fname) => {
// only listen for "change" events, as renames are noisy
// ignore hidden files
const isHidden = /^\./.test(fname);
if (ev !== "change" || isHidden) {
if (ev !== "change" || fname.startsWith('.')) {
return;
}
on_change(path.join(dir, fname));