Object.keys().forEach() --> for..of

This commit is contained in:
Jason Miller
2018-03-27 20:47:38 -04:00
parent 2ff3de518d
commit e501ffff85

View File

@@ -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();
}); });
} }