From ba19b7441774bd18e0c7f0def1e0f3032b209f77 Mon Sep 17 00:00:00 2001 From: Sorin Coza Date: Sun, 12 May 2019 22:02:14 +0300 Subject: [PATCH] Add filterLocalFiles --- lib/filter.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/filter.js b/lib/filter.js index eb07ca2..45d4dd2 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -63,6 +63,29 @@ module.exports = { }, options ); - } + }, + + + /** + * Filter local files without checking with remote, because it's much faster + * - use case: if the local repo is the source of truth + */ + filterLocalFiles: function ( folder, filter, options ) { + + options = this.makeOptions( options ); + + return this.parallel( function ( file, cb ) { + + filter( file, true, onFilter ); + + function onFilter( err, emit ) { + + cb( err, emit ? file : null ); + + } + + }, options ); + + }, };