UNPKG

@opengis/fastify-table

Version:

core-plugins

15 lines (14 loc) 505 B
import fs from "node:fs"; import getTemplatePath from "./getTemplatePath.js"; import loadTemplate from "./loadTemplate.js"; export default function getTemplateDir(type) { if (!type) return null; const arr = Array.isArray(type) ? type.map((el) => getTemplatePath(el)).flat() : getTemplatePath(type); if (!loadTemplate[type.toString()]) { loadTemplate[type.toString()] = arr.filter((el) => fs.existsSync(el[1])); } return loadTemplate[type.toString()]; }