lib/index.js
function fileShouldBeDeleted(key, whitelist) {
  for (var i = 0; i < whitelist.length; i++) {
    var expr = whitelist[i];
    if (expr instanceof RegExp) {
      if (expr.test(key)) {
        return false;
      }
    } else if (typeof expr === 'string') {
      if (expr === key) {
        return false;
      }
    } else {
      throw new Error(
        'whitelist param can only contain regular expressions or strings'
      );
    }
  }
  return true;
}
function fileShouldBeDeleted(key, whitelist) {
  for (var i = 0; i < whitelist.length; i++) {
    var expr = whitelist[i];
    if (expr instanceof RegExp) {
      if (expr.test(key)) {
        return false;
      }
    } else if (typeof expr === 'string') {
      if (expr === key) {
        return false;
      }
    } else {
      throw new Error(
        'whitelist param can only contain regular expressions or strings'
      );
    }
  }
  return true;
}
function fileShouldBeDeleted ( key , whitelist ) { for ( var i = 0 ; i < whitelist . length ; i ++ ) { var expr = whitelist [ i ] ; if ( expr instanceof RegExp ) { if ( expr . test ( key ) ) { return false ; } } else if ( typeof expr === 'string' ) { if ( expr === key ) { return false ; } } else { throw new Error ( 'whitelist param can only contain regular expressions or strings' ) ; } } return true ; }
init file s3 hash
@param  {String} key filepath
@param  {Array} whitelist list of expressions that match against files that should not be deleted

@return {Boolean} shouldDelete whether the file should be deleted or not
@api private
init file s3 hash @param { String } key filepath @param { Array } whitelist list of expressions that match against files that should not be deleted