function pathMatches(filePath, basePath, config) {

	// a config without `files` field always match
	if (!config.files) {
		return true;
	}

	/*
	 * For both files and ignores, functions are passed the absolute
	 * file path while strings are compared against the relative
	 * file path.
	 */
	const relativeFilePath = path.relative(basePath, filePath);

	// if files isn't an array, throw an error
	if (!Array.isArray(config.files) || config.files.length === 0) {
		throw new TypeError('The files key must be a non-empty array.');
	}

	// match both strings and functions
	const match = pattern => {

		if (isString(pattern)) {
			return minimatch(relativeFilePath, pattern, MINIMATCH_OPTIONS);
		}

		if (typeof pattern === 'function') {
			return pattern(filePath);
		}

		throw new TypeError(`Unexpected matcher type ${pattern}.`);
	};

	// check for all matches to config.files
	let filePathMatchesPattern = config.files.some(pattern => {
		if (Array.isArray(pattern)) {
			return pattern.every(match);
		}

		return match(pattern);
	});

	/*
	 * If the file path matches the config.files patterns, then check to see
	 * if there are any files to ignore.
	 */
	if (filePathMatchesPattern && config.ignores) {
		filePathMatchesPattern = !shouldIgnoreFilePath(config.ignores, filePath, relativeFilePath);
	}

	return filePathMatchesPattern;
}
/**
 * Determines if a given file path is matched by a config. If the config
 * has no `files` field, then it matches; otherwise, if a `files` field
 * is present then we match the globs in `files` and exclude any globs in
 * `ignores`.
 * @param {string} filePath The absolute file path to check.
 * @param {Object} config The config object to check.
 * @returns {boolean} True if the file path is matched by the config,
 *      false if not.
 */
Determines if a given file path is matched by a config.
Determines if a given file path is matched by a config .
function pathMatches(filePath, basePath, config) {
	if (!config.files) {
		return true;
	}
	const relativeFilePath = path.relative(basePath, filePath);
	if (!Array.isArray(config.files) || config.files.length === 0) {
		throw new TypeError('The files key must be a non-empty array.');
	}
	const match = pattern => {
		if (isString(pattern)) {
			return minimatch(relativeFilePath, pattern, MINIMATCH_OPTIONS);
		}
		if (typeof pattern === 'function') {
			return pattern(filePath);
		}
		throw new TypeError(`Unexpected matcher type ${pattern}.`);
	};
	let filePathMatchesPattern = config.files.some(pattern => {
		if (Array.isArray(pattern)) {
			return pattern.every(match);
		}
		return match(pattern);
	});
	if (filePathMatchesPattern && config.ignores) {
		filePathMatchesPattern = !shouldIgnoreFilePath(config.ignores, filePath, relativeFilePath);
	}
	return filePathMatchesPattern;
}
function pathMatches ( filePath , basePath , config ) { if ( ! config . files ) { return true ; } const relativeFilePath = path . relative ( basePath , filePath ) ; if ( ! Array . isArray ( config . files ) || config . files . length === 0 ) { throw new TypeError ( 'The files key must be a non-empty array.' ) ; } const match = pattern => { if ( isString ( pattern ) ) { return minimatch ( relativeFilePath , pattern , MINIMATCH_OPTIONS ) ; } if ( typeof pattern === 'function' ) { return pattern ( filePath ) ; } throw new TypeError ( ` ${ pattern } ` ) ; } ; let filePathMatchesPattern = config . files . some ( pattern => { if ( Array . isArray ( pattern ) ) { return pattern . every ( match ) ; } return match ( pattern ) ; } ) ; if ( filePathMatchesPattern && config . ignores ) { filePathMatchesPattern = ! shouldIgnoreFilePath ( config . ignores , filePath , relativeFilePath ) ; } return filePathMatchesPattern ; }
Determines if a given file path is matched by a config.
Determines if a given file path is matched by a config .
// a config without `files` field always match /*
	 * For both files and ignores, functions are passed the absolute
	 * file path while strings are compared against the relative
	 * file path.
	 */ // if files isn't an array, throw an error // match both strings and functions // check for all matches to config.files /*
	 * If the file path matches the config.files patterns, then check to see
	 * if there are any files to ignore.
	 */