Created
January 19, 2020 14:35
-
-
Save antonvolkoff/b111e0f6a98f509dd3855acf116bda06 to your computer and use it in GitHub Desktop.
Rules for switchboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rule { | |
private operations: Array<any>; | |
constructor() { | |
this.operations = []; | |
} | |
filter(options): Rule { | |
this.operations.push({ action: 'filter', options }); | |
return this; | |
} | |
store(options): Rule { | |
this.operations.push({ action: 'store', options }); | |
return this; | |
} | |
send(options): Rule { | |
this.operations.push({ action: 'send', options }); | |
return this; | |
} | |
} | |
const rule = () => new Rule(); | |
rule().filter({ to: "outpostr.com" }).send({ adapter: "outpostr" }); | |
rule().filter({ from: "outpostr.com" }).send({ adapter: "mailgun" }); | |
rule().filter({ from: "antonvolkoff.com" }).send({ adapter: "mailgun" }); | |
rule().filter({ to: "antonvolkoff.com" }).send({ adapter: "outpostr" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment