chore(pockethost): filter debugging

This commit is contained in:
Ben Allfree 2024-06-29 14:24:25 -07:00
parent 879845a831
commit dd3ceaa324
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'pockethost': patch
---
Added filter debugging

View File

@ -63,7 +63,14 @@ async function filter<TCarry, TContext extends {} = {}>(
if (!filter) return initialValue
return filter.reduce(
(carry, entry) =>
carry.then((carryRes) => entry.handler(carryRes, context)),
carry
.then((carryRes) => entry.handler(carryRes, context))
.then((carryRes) => {
if (DEBUG()) {
console.log(`f:${filterName}`, carryRes, context)
}
return carryRes
}),
Promise.resolve(initialValue),
) as TCarry
}