Skip to content

Commit

Permalink
Use Bluebird#tap()
Browse files Browse the repository at this point in the history
  • Loading branch information
segayuu committed Oct 24, 2018
1 parent e4fba52 commit 8ae1700
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/plugins/generator/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ function assetGenerator(locals) {
const self = this;

function process(name) {
return Promise.filter(self.model(name).toArray(), asset => fs.exists(asset.source).then(exist => {
if (exist) return exist;
return asset.remove().thenReturn(exist);
return Promise.filter(self.model(name).toArray(), asset => fs.exists(asset.source).tap(exist => {
if (!exist) return asset.remove();
})).map(asset => {
const source = asset.source;
let path = asset.path;
Expand Down

0 comments on commit 8ae1700

Please sign in to comment.