Filter ignored files

@param {Array} files
@param {Array} ignore
970411
function filterIgnored(files, ignore, fn) {
  fn(null, files.filter(function(file) {
    // TODO make more robust
    return !~ignore.indexOf(file) && !~ignore.indexOf(file + '/');
  }));
}
766165
function filterFiles( files ){
    var filtered = [],
        file,
        i;
    for( i = 0; i < files.length; i++ ){
        file = files[ i ];
        if( file.height &&
            file.width &&
            file.url ){
            //This is sufficient to serve as a level
            filtered.push({
                url: file.url,
                width: Number( file.width ),
                height: Number( file.height )
            });
        }
        else {
            $.console.error( 'Unsupported image format: %s', file.url ? file.url : '<no URL>' );
        }
    }

    return filtered.sort(function(a, b) {
        return a.height - b.height;
    });

}
328412
function filter(file) {
    if (files.indexOf(file) !== -1) return false;
    let include = true;
    regexs.forEach((regex) => {
      if (file.search(regex) !== -1) include = false;
    });
    return include;
  }
207065
function extractFolders( files ) {
    return files.data.files.map( function extractPath( file ) {
      return path.parse( file ).dir;
    }).filter( function extractUnique( path, index, array ) {
      return array.indexOf( path ) === index;
    });
  }
247083
function getFeatureFiles(args, ignoreArg) {
  var files = [];
  var patterns = args.length ? args : ['.'];

  patterns.forEach(function(pattern) {
    // First we need to fix up the pattern so that it only matches .feature files
    // and it's in the format that glob expects it to be
    var fixedPattern;
    if (pattern == '.') {
      fixedPattern = '**/*.feature';
    } else if (pattern.match(/.*\/\*\*/)) {
      fixedPattern = pattern + '/**.feature';
    } else if (pattern.match(/.*\.feature/)) {
      fixedPattern = pattern;
    } else {
      try {
        if (fs.statSync(pattern).isDirectory()) {
          fixedPattern = path.join(pattern, '**/*.feature');
        }
      } catch(e) {
        // Don't show the fs callstack, we will print a custom error message bellow instead
      }
    }

    if (!fixedPattern) {
      logger.boldError(`Invalid format of the feature file path/pattern: "${pattern}".\nTo run the linter please specify an existing feature file, directory or glob.`);
      process.exit(1);
      return; // This line will only be hit by tests that stub process.exit
    }

    var globOptions = {ignore: getIgnorePatterns(ignoreArg)};
    files = files.concat(glob.sync(fixedPattern, globOptions));
  });
  return _.uniq(files);
}
338972
function setFilesets(path, done) {
    var config = JSON.parse(fs.readFileSync(path, 'utf8'));

    /* jshint sub: true */
    var includeFiles = config['includeFiles'];
    var excludeFiles = config['excludeFiles'];
    var filterFiles = config['lintOnly'];
    /* jshint sub: false */

    if (filterFiles && !Array.isArray(filterFiles)) {
        filterFiles = [];
        console.log(chalk.yellow('invalid `lintOnly` set; ignoring'));
    }

    if (includeFiles && Array.isArray(includeFiles)) {
        filesets.include(includeFiles, filterFiles);
    } else {
        console.log(chalk.yellow('valid `includeFiles` not found in %s'), path);
    }

    if (excludeFiles && Array.isArray(includeFiles)) {
        filesets.exclude(excludeFiles);
    } else {
        console.log(chalk.yellow('valid `excludeFiles` not found in %s'), path);
    }

    done();
}
210486
private function applyExcludesAndIncludes(array $files, array $excludes = [], array $includes = []): array
    {
        if (!$excludes) {
            return $files;
        }

        foreach ($files as $key => $file) {
            if ($this->isMatch($file['relative_path'], $excludes)
                && !$this->isMatch(
                    $file['relative_path'],
                    $includes
                )) {
                unset($files[$key]);
            }
        }

        // Reindex to avoid confusion when comparing last index to count
        return array_values($files);
    }
407213
function filterFilesFromManifest(manifest, selector, logName) {
    // By removing files from the index, when the manifest is sorted and
    // validated, unreachable modules are removed.
    var removedFiles = [];
    manifest.indexes = Object.keys(manifest.indexes)
    .reduce(function(indexes, file) {
        if (selector(file)) {
            indexes[file] = manifest.indexes[file];
        } else {
            removedFiles.push(file);
            debug(file + ' removed from ' + logName);
        }
        return indexes;
    }, {});

    // Also, we need to make sure deps are updated to "false", which marks
    // the dep as external
    Object.keys(manifest.indexes).forEach(function(file) {
        var bundle = manifest.bundles[manifest.indexes[file]];
        bundle.data.forEach(function(module) {
            Object.keys(module.deps).forEach(function(key) {
                var value = module.deps[key];
                if (removedFiles.indexOf(value) >=0) {
                    module.deps[key] = false;
                }
            });
        });
    });
}
289725
function listFiles(root, options) {
    options = _.defaults(options || {}, {
        ignoreFiles: [],
        ignoreRules: []
    });

    var d = Q.defer();

    // Our list of files
    var files = [];

    var ig = Ignore({
        path: root,
        ignoreFiles: options.ignoreFiles
    });

    // Add extra rules to ignore common folders
    ig.addIgnoreRules(options.ignoreRules, '__custom_stuff');

    // Push each file to our list
    ig.on('child', function (c) {
        files.push(
            c.path.substr(c.root.path.length + 1) + (c.props.Directory === true ? '/' : '')
        );
    });

    ig.on('end', function() {
        // Normalize paths on Windows
        if(process.platform === 'win32') {
            return d.resolve(files.map(function(file) {
                return file.replace(/\\/g, '/');
            }));
        }

        // Simply return paths otherwise
        return d.resolve(files);
    });

    ig.on('error', d.reject);

    return d.promise;
}
721498
protected function ignoredFiles()
    {
        $lines = file($this->path());

        $ignored_files = [];
        foreach ($lines as $line) {
            $file = preg_replace("/\r|\n/", "", $line);
            if (!File::exists(base_path($file))) {
                continue;
            }
            $ignored_files[] = $file;
        }
        return $ignored_files;
    }
330318
function deleteDirectoryFiles(directory, filter = () => true) {
  return readDirectoryFiles(directory)
    .then((files) => {
      const quietDelete = f => deleteFile(path.join(directory, f)).catch(() => null);
      const deletingFiles = files.filter(filter).map(quietDelete);
      return Promise.all(deletingFiles).then(deleted => deleted.filter(d => d !== null));
    });
}
912708
function filterFilesForUnchangedTasks(before, after, paths) {
  var pathsRes = [];
  var tasksRes = [];

  for (var i = 0; i < before.length; i++) {
    var unchangedTasks = filterUnchangedTasks(before[i], after[i]);
    if (unchangedTasks.length > 0) {
      tasksRes.push(unchangedTasks);
      pathsRes.push(paths[i]);
    }
  }

  return [tasksRes, pathsRes];
}
326805
static function collect_files( $dpath, $r = false, $match = null, $ignore = null ){
		$paths = array();
		$dhandle = opendir( $dpath );
		while( $f = readdir($dhandle) ){
			if( $f === '.' || $f === '..' ){
				continue;
			}
			// pattern tested only on file name
			// ignore pattern applies to directories as well as files
			if( isset($ignore) && preg_match($ignore, $f) ){
				continue;
			}
			$path = $dpath.'/'.$f;
			if( is_dir($path) ){
				if( $r ){
					$paths = array_merge( $paths, self::collect_files($path, true, $match, $ignore) );
				}
			}
			// test match requirement on files only
			else if( isset($match) && ! preg_match($match, $f) ){
				continue;
			} 
			// else file ok to collect
			else {
				$paths[] = $path;
			}
		}
		closedir($dhandle);
		return $paths;
	}
54869
function removeDuplicates(files, duplicates) {
        var i;
        var ret = [];
        var found = {};

        if (duplicates) {
            for (i=0; i < duplicates.length; i++) {
                found[duplicates[i].dst] = true;
            }
        }

        for (i=0; i < files.length; i++) {
            if (!found[files[i].dst]) {
                found[files[i].dst] = true;
                ret.push(files[i]);
            }
        }
        return ret;
    }
565754
def ignore(self, filename):
        """"""
        _, ext = os.path.splitext(filename)
        return ext in ['.pyc', '.pyo', '.o', '.swp']
1100431
def ignored?(path)
      @@conf.ignore.each do |ignore|
        return true if rel_path(path).match(ignore)
      end
      return false
    end
343065
protected function filterZipFiles(ZipArchive $archive, array $ignore = [], array $force = [])
    {
        $dirName = $archive->getNameIndex(0);
        $return = [];
        $numFiles = $archive->getNumFiles();
        for ($i = 0; $i < $numFiles; ++$i) {
            $stat = $archive->statIndex($i);
            $return[] = $stat['name'];
        }
        $that = $this;
        $filter = array_filter($return, function ($var) use ($ignore, $force, $dirName, $that) {
            return !$that->isIgnored($var, $ignore, $force, $dirName);
        });

        return array_values($filter);
    }