UNPKG

@opengis/fastify-table

Version:

core-plugins

13 lines (12 loc) 419 B
import { basename } from "node:path"; import { existsSync } from "node:fs"; import menuDirs from "./menuDirs.js"; export default function addMenu(filepath) { if (basename(filepath) !== "menu.json") { throw new Error("addMenu: filepath must be a menu.json file"); } if (filepath && !menuDirs.includes(filepath) && existsSync(filepath)) { menuDirs.push(filepath); } return menuDirs; }