summaryrefslogtreecommitdiff
path: root/node_modules/@11ty/eleventy/src/Util/DirContains.js
blob: c19990cbd379ec0fa32d3c934ec5f74504c6f8d6 (plain)
1
2
3
4
5
6
7
8
9
10
import path from "node:path";

// Returns true if subfolder is in parent (accepts absolute or relative paths for both)
export default function (parentFolder, subFolder) {
	// path.resolve returns an absolute path
	if (path.resolve(subFolder).startsWith(path.resolve(parentFolder))) {
		return true;
	}
	return false;
}