function files(dir) {
	const listedDirs = [];
	let transform = (item) => item;
	if (typeof dir === "string") {
		return Object.values(filesTree).find((item) => getFile(dir, item));
	} else if (typeof dir === "function") {
		transform = dir;
	}

	const allFiles = [];
	Object.values(filesTree).forEach((item) => {
		allFiles.push(...flattenTree(item, transform, listedDirs));
	});
	return allFiles;
}
Get all files in a folder
@param {string|()=>object} dir
@returns {Tree[]}