fix(core): update

This commit is contained in:
2019-08-07 16:34:34 +02:00
parent eb9151e23e
commit 5371bd058a
10 changed files with 72 additions and 31 deletions

View File

@ -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;
};
};

View File

@ -3,6 +3,4 @@ import * as plugins from './smartguard.plugins';
/**
* a block handler is used
*/
export class BlockHandler {
}
export class BlockHandler {}

View File

@ -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;
}
}
}

View File

@ -20,4 +20,4 @@ export class GuardSet<T> {
const results = Promise.all(resultPromises);
return results;
}
}
}

View File

@ -1,6 +1,4 @@
import * as smartpromise from '@pushrocks/smartpromise';
// pushrocks scope
export {
smartpromise
};
export { smartpromise };