Expand description
§glob-parent — the non-magic parent of a glob
Given a glob, return the deepest parent directory that contains no glob magic —
exactly what file watchers and build tools need to know which directory to watch.
A faithful Rust port of the glob-parent
npm package (used by gulp, chokidar, and friends), bundling ports of is-glob
and is-extglob. Zero dependencies and #![no_std].
use glob_parent::glob_parent;
assert_eq!(glob_parent("path/to/*.js"), "path/to");
assert_eq!(glob_parent("path/*/file.js"), "path");
assert_eq!(glob_parent("path/**/*.js"), "path");
assert_eq!(glob_parent("*.js"), ".");
assert_eq!(glob_parent("/path/to/file.js"), "/path/to");Functions§
- glob_
parent - Extract the non-magic parent path from a
glob. - glob_
parent_ with_ options - Extract the non-magic parent path from a
glob. - is_
extglob - Whether
scontains an extglob pattern such as@(…),!(…), or+(…)(theis-extglobnpm package). - is_glob
- Whether
slooks like a glob (the strict check of theis-globnpm package).