@tsed/platform-http
Version:
A TypeScript Framework on top of Express
17 lines (16 loc) • 529 B
JavaScript
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;
}, []);
}