fix(core): update
This commit is contained in:
@ -8,11 +8,11 @@ export const passGuards = async <T>(dataArg: T, guards: Array<Guard<T>>) => {
|
||||
const guardSet = new GuardSet<T>(guards);
|
||||
const results = await guardSet.executeGuardsWithData(dataArg);
|
||||
for (const result of results) {
|
||||
if(!result) {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
done.resolve();
|
||||
await done.promise;
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
@ -3,6 +3,4 @@ import * as plugins from './smartguard.plugins';
|
||||
/**
|
||||
* a block handler is used
|
||||
*/
|
||||
export class BlockHandler {
|
||||
|
||||
}
|
||||
export class BlockHandler {}
|
||||
|
@ -3,7 +3,7 @@ import * as plugins from './smartguard.plugins';
|
||||
export type TGuardFunction<T> = (dataArg: T) => Promise<boolean>;
|
||||
|
||||
export class Guard<T> {
|
||||
private guardFunction: TGuardFunction<T>;
|
||||
private guardFunction: TGuardFunction<T>;
|
||||
constructor(guardFunctionArg: TGuardFunction<T>) {
|
||||
this.guardFunction = guardFunctionArg;
|
||||
}
|
||||
@ -16,4 +16,4 @@ export class Guard<T> {
|
||||
const result = await this.guardFunction(dataArg);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,4 +20,4 @@ export class GuardSet<T> {
|
||||
const results = Promise.all(resultPromises);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
// pushrocks scope
|
||||
export {
|
||||
smartpromise
|
||||
};
|
||||
export { smartpromise };
|
||||
|
Reference in New Issue
Block a user