UNPKG

actionhero

Version:

actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks

18 lines (17 loc) 338 B
/** * Sorts an Array of Objects with a priority key */ export function sortGlobalMiddleware( globalMiddlewareList: Array<any>, middleware: { [key: string]: any; } ) { globalMiddlewareList.sort((a, b) => { if (middleware[a].priority > middleware[b].priority) { return 1; } else { return -1; } }); }