@captain-hook/core
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -9,8 +9,14 @@ "use strict"; | ||
const chain = (payload, ...plugins) => { | ||
let current = { ...payload | ||
}; | ||
for (const plugin of plugins) { | ||
// eslint-disable-next-line no-continue | ||
if (!plugin?.test?.(payload)) continue; | ||
const shouldContinue = plugin.receive(payload); | ||
if (!plugin?.test?.(current)) { | ||
// eslint-disable-next-line no-continue | ||
continue; | ||
} | ||
if (!shouldContinue) { | ||
current = plugin.receive(current); | ||
if (!current) { | ||
break; | ||
@@ -17,0 +23,0 @@ } |
{ | ||
"name": "@captain-hook/core", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "web(hook hand)lers", | ||
@@ -12,3 +12,4 @@ "author": "Luke Smetham", | ||
"jsonwebtoken": "^8.5.1" | ||
} | ||
}, | ||
"gitHead": "089afb824971564bf8e0a77f9c69b388512211c4" | ||
} |
export const chain = (payload, ...plugins) => { | ||
for (const plugin of plugins) { | ||
// eslint-disable-next-line no-continue | ||
if (!plugin?.test?.(payload)) continue; | ||
let current = {...payload}; | ||
const shouldContinue = plugin.receive(payload); | ||
for (const plugin of plugins) { | ||
if (!plugin?.test?.(current)) { | ||
// eslint-disable-next-line no-continue | ||
continue; | ||
} | ||
if (!shouldContinue) { | ||
break; | ||
} | ||
} | ||
current = plugin.receive(current); | ||
if (!current) { | ||
break; | ||
} | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4309
128