refactor: delegate IsDir decision

This commit is contained in:
TJ Holowaychuk
2017-11-18 17:24:51 -08:00
parent 22ccac07ea
commit bfa79a2ef4
+4 -4
View File
@@ -36,10 +36,6 @@ func (p Pruner) Prune() (*Stats, error) {
return err
}
if info.IsDir() {
return nil
}
stats.FilesTotal++
if !p.prune(path, info) {
@@ -62,6 +58,10 @@ func (p Pruner) Prune() (*Stats, error) {
// prune returns true if the file or dir should be pruned.
func (p Pruner) prune(path string, info os.FileInfo) bool {
if info.IsDir() {
return false
}
ext := filepath.Ext(path)
return ext == ".ts" || ext == ".md"
}