import chalk from 'chalk' ; export default function filterFiles ( filter ) { return ( files , metalsmith , done ) => { if ( ! filter || typeof filter !== 'function' ) { return done ( ) ; } console . log ( ) ; Object . keys ( files ) . forEach ( file => { if ( filter ( file , metalsmith . metadata ( ) ) ) { delete files [ file ] ; } else { console . log ( `  ${ chalk . yellow ( 'create' ) }    ${ file }` ) ; } } ) ; console . log ( ) ; done ( ) ; } ; }