INNER CODE UNIT · JavaScript
callback
ScanNet/ScanNet · WebUI/src/hooks/index.js:36
const callback = () => true;
return function (hook) {
if (hook.type === 'after') {
throw new errors.GeneralError(`Provider '${hook.params.provider}' can not rewrite query params on after hook.`);
}
const result = hook.params.query;
const next = condition => {
if (result && condition) {
rewriteQueries(result);
}
return hook;
};
const check = callback(hook);
return check && typeof check.then === 'function'
? check.then(next) : next(check);