MCPcopy
hub / github.com/Automattic/mongoose / buildMiddlewareFilter

Function buildMiddlewareFilter

lib/helpers/buildMiddlewareFilter.js:17–20  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

15 * @returns {Function|null} - null runs all middleware, isBuiltInMiddleware skips user middleware
16 */
17function buildMiddlewareFilter(options, phase) {
18 const shouldRun = options?.middleware?.[phase] ?? options?.middleware ?? true;
19 return shouldRun ? null : isBuiltInMiddleware;
20}
21
22module.exports = {
23 buildMiddlewareFilter

Callers 10

aggregate.jsFile · 0.85
model.jsFile · 0.85
_insertManyFunction · 0.85
_bulkWriteFunction · 0.85
buildPreSavePromiseFunction · 0.85
handleSuccessfulWriteFunction · 0.85
_executePostHooksFunction · 0.85
_executePreHooksFunction · 0.85
document.jsFile · 0.85
applyHooksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…