UNPKG

@tsed/platform-http

Version:
17 lines (16 loc) 529 B
import { getValue } from "@tsed/core"; function mapOptions(options) { const opts = typeof options === "string" ? { root: options } : options; return { ...opts, hook: getValue(opts, "hook", "$afterRoutesInit") }; } export function getStaticsOptions(statics) { return Object.entries(statics || {}).reduce((statics, [path, items]) => { [].concat(items).forEach((options) => { statics.push({ path, options: mapOptions(options) }); }); return statics; }, []); }