* Builds a filter for kareem's execPre/execPost based on middleware options. * * @param {object} options - Options object that may contain `middleware` setting * @param {string} phase - Either 'pre' or 'post' * @returns {Function|null} - null runs all middleware, isBuiltInMiddleware skips user m
(options, phase)
| 15 | * @returns {Function|null} - null runs all middleware, isBuiltInMiddleware skips user middleware |
| 16 | */ |
| 17 | function buildMiddlewareFilter(options, phase) { |
| 18 | const shouldRun = options?.middleware?.[phase] ?? options?.middleware ?? true; |
| 19 | return shouldRun ? null : isBuiltInMiddleware; |
| 20 | } |
| 21 | |
| 22 | module.exports = { |
| 23 | buildMiddlewareFilter |
no outgoing calls
no test coverage detected
searching dependent graphs…