From 8ae17002f207bcfd17e4e8fdd561da63e62b99c2 Mon Sep 17 00:00:00 2001 From: segayuu Date: Wed, 24 Oct 2018 11:34:01 +0900 Subject: [PATCH] Use Bluebird#tap() --- lib/plugins/generator/asset.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/plugins/generator/asset.js b/lib/plugins/generator/asset.js index dce1b0c947..f816677ce3 100644 --- a/lib/plugins/generator/asset.js +++ b/lib/plugins/generator/asset.js @@ -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;