blob: a4a6c5507a5818a1cff9413aebe170667008ab12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import picomatch from "picomatch";
import { TemplatePath } from "@11ty/eleventy-utils";
function isGlobMatch(filepath, globs = [], options = undefined) {
if (!filepath || !Array.isArray(globs) || globs.length === 0) {
return false;
}
let inputPath = TemplatePath.stripLeadingDotSlash(filepath);
let opts = Object.assign(
{
dot: true,
nocase: true, // insensitive
},
options,
);
// globs: string or array of strings
return picomatch.isMatch(inputPath, globs, opts);
}
export { isGlobMatch };
|