lib/mincer/base.js
function matches_filter(filters, logicalPath, filename) {
  if (filters.length === 0) {
    return true;
  }

  return _.some(filters, function (filter) {
    if (_.isRegExp(filter)) {
      return filter.test(logicalPath);
    }

    if (_.isFunction(filter)) {
      return filter(logicalPath, filename);
    }

    // prepare string to become RegExp.
    // mimics shell's globbing
    filter = filter.toString().replace(/\*\*|\*|\?|\\.|\./g, function (m) {
      if (m[0] === '*') {
        return m === '**' ? '.+?' : '[^/]+?';
      }

      if (m[0] === '?') {
        return '[^/]?';
      }

      if (m[0] === '.') {
        return '\\.';
      }

      // handle `\\.` part
      return m;
    });

    // prepare RegExp
    filter = new RegExp('^' + filter + '$');
    return filter.test(logicalPath);
  });
}
function matches_filter(filters, logicalPath, filename) {
  if (filters.length === 0) {
    return true;
  }

  return _.some(filters, function (filter) {
    if (_.isRegExp(filter)) {
      return filter.test(logicalPath);
    }

    if (_.isFunction(filter)) {
      return filter(logicalPath, filename);
    }

    // prepare string to become RegExp.
    // mimics shell's globbing
    filter = filter.toString().replace(/\*\*|\*|\?|\\.|\./g, function (m) {
      if (m[0] === '*') {
        return m === '**' ? '.+?' : '[^/]+?';
      }

      if (m[0] === '?') {
        return '[^/]?';
      }

      if (m[0] === '.') {
        return '\\.';
      }

      // handle `\\.` part
      return m;
    });

    // prepare RegExp
    filter = new RegExp('^' + filter + '$');
    return filter.test(logicalPath);
  });
}
function matches_filter ( filters , logicalPath , filename ) { if ( filters . length === 0 ) { return true ; } return _ . some ( filters , function ( filter ) { if ( _ . isRegExp ( filter ) ) { return filter . test ( logicalPath ) ; } if ( _ . isFunction ( filter ) ) { return filter ( logicalPath , filename ) ; } // prepare string to become RegExp. // mimics shell's globbing filter = filter . toString ( ) . replace ( / \*\*|\*|\?|\\.|\. / g , function ( m ) { if ( m [ 0 ] === '*' ) { return m === '**' ? '.+?' : '[^/]+?' ; } if ( m [ 0 ] === '?' ) { return '[^/]?' ; } if ( m [ 0 ] === '.' ) { return '\\.' ; } // handle `\\.` part return m ; } ) ; // prepare RegExp filter = new RegExp ( '^' + filter + '$' ) ; return filter . test ( logicalPath ) ; } ) ; }
Returns true if there were no filters, or `filename` matches at least one
Returns true if there were no filters or filename matches at least one