actionhero
Version:
The reusable, scalable, and quick node.js API server for stateless and stateful applications
18 lines (17 loc) • 338 B
text/typescript
/**
* 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;
}
});
}