@rr0/cms
Version:
RR0 Content Management System (CMS)
12 lines (11 loc) • 399 B
JavaScript
import { globSync } from "glob";
export class RR0FileUtil {
static findDirectoriesContaining(fileName, exclude = "") {
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
return (globSync(`!(${exclude})/**/${fileName}`))
.map(path => path.substring(0, path.lastIndexOf("/")))
.filter(onlyUnique);
}
}