mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-16 18:49:50 +00:00
Object.keys().forEach() --> for..of
This commit is contained in:
@@ -17,13 +17,13 @@ module.exports = class WatchTimestampsPlugin {
|
|||||||
const patterns = this.patterns;
|
const patterns = this.patterns;
|
||||||
const timestamps = watch.fileTimestamps;
|
const timestamps = watch.fileTimestamps;
|
||||||
|
|
||||||
Object.keys(timestamps).forEach(filepath => {
|
for (const filepath of timestamps) {
|
||||||
if (patterns.some(pat => pat instanceof RegExp ? pat.test(filepath) : filepath.indexOf(pat) === 0)) {
|
if (patterns.some(pat => pat instanceof RegExp ? pat.test(filepath) : filepath.indexOf(pat) === 0)) {
|
||||||
let time = fs.statSync(filepath).mtime;
|
let time = fs.statSync(filepath).mtime;
|
||||||
if (timestamps instanceof Map) timestamps.set(filepath, time);
|
if (timestamps instanceof Map) timestamps.set(filepath, time);
|
||||||
else timestamps[filepath] = time;
|
else timestamps[filepath] = time;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user