diff options
Diffstat (limited to 'node_modules/@11ty/eleventy/src/Util/GlobMatcher.js')
| -rw-r--r-- | node_modules/@11ty/eleventy/src/Util/GlobMatcher.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js b/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js new file mode 100644 index 0000000..a4a6c55 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js @@ -0,0 +1,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 }; |
