turbo-gulp
Version:
Gulp tasks to boost high-quality projects.
28 lines (27 loc) • 807 B
JavaScript
import { Minimatch } from "minimatch";
import { posix as path } from "path";
export function join(prefix, matcher) {
let result;
if (matcher.comment || path.isAbsolute(matcher.pattern)) {
result = new Minimatch(matcher.pattern);
}
else {
result = new Minimatch(path.join(prefix, matcher.pattern), matcher.options);
}
result.negate = matcher.negate;
return result;
}
export function relative(from, matcher) {
let result;
if (matcher.comment) {
result = new Minimatch(matcher.pattern);
}
else {
result = new Minimatch(path.relative(from, matcher.pattern), matcher.options);
}
result.negate = matcher.negate;
return result;
}
export function asString(matcher) {
return (matcher.negate ? "!" : "") + matcher.pattern;
}