UNPKG

alia

Version:
26 lines (25 loc) 694 B
export class Flag { confService; gistService; flag; constructor(confService, gistService) { this.confService = confService; this.gistService = gistService; } mods = []; async run(args, data) { const mods = this.mods.filter((m) => Object.keys(data).includes(m.key)); for (const mod of mods) { const value = data[mod.key]; const result = await mod.run?.(value); if (result === false) { return false; } } const result = await this.flag.run?.(args, data); if (result === undefined) { return true; } return result; } }