diff --git a/resources/docs/Documentation.md b/resources/docs/Documentation.md index 1db5761ee..21f1bccb0 100644 --- a/resources/docs/Documentation.md +++ b/resources/docs/Documentation.md @@ -172,10 +172,13 @@ Note that `MessageObject` attributes which can be synchronized with service are | Method | `runExecutableGetOutput(String, String[])` | `String` | `utils.runExecutableGetOutput('cmd.exe', ['/c', 'dir'])` | Launches external executable with optional parameters, reads its standard output and returns the output when executable finishes. #### Examples -Accept only messages/articles with title containing "Series Name" in it: +Accept only messages/articles with title containing "Series Name" or "Another series" in it (whitelist): ```js +var whitelist = [ + 'Series Name', 'Another series' +]; function filterMessage() { - if (msg.title.indexOf('Series Name') != -1) { + if (whitelist.some(i => msg.title.indexOf(i) != -1)) { return MessageObject.Accept; } else { return MessageObject.Ignore; @@ -183,13 +186,16 @@ function filterMessage() { } ``` -Accept only messages/articles with title NOT containing "Other Series Name" or "Some other title" in it: +Accept only messages/articles with title NOT containing "Other Series Name" or "Some other title" in it (blacklist): ```js +var blacklist = [ + 'Other Series Name', 'Some other title' +]; function filterMessage() { - if (msg.title.indexOf('Other Series Name') == -1 && msg.title.indexOf('Some other title') == -1) { - return MessageObject.Accept; - } else { + if (blacklist.some(i => msg.title.indexOf(i) != -1)) { return MessageObject.Ignore; + } else { + return MessageObject.Accept; } } ```