commit f3a6e16: [Minor] Selectors: Add equal processor

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 27 18:28:06 UTC 2018


Author: Vsevolod Stakhov
Date: 2018-12-11 20:05:25 +0000
URL: https://github.com/rspamd/rspamd/commit/f3a6e16277b4580a03af56476b66df379818bec6

[Minor] Selectors: Add equal processor

---
 lualib/lua_selectors.lua | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua
index cc137bddd..8d68341b4 100644
--- a/lualib/lua_selectors.lua
+++ b/lualib/lua_selectors.lua
@@ -497,6 +497,22 @@ the second argument is optional hash type (`blake2`, `sha256`, `sha1`, `sha512`,
     ['description'] = 'Drops input value and return values from function\'s arguments or an empty string',
     ['args_schema'] = (ts.string + ts.array_of(ts.string)):is_optional()
   },
+  ['equal'] = {
+    ['types'] = {
+      ['string'] = true,
+    },
+    ['map_type'] = 'string',
+    ['process'] = function(inp, _, args)
+      if inp == args[1] then
+        return inp,'string'
+      end
+
+      return nil
+    end,
+    ['description'] = [[Boolean function equal.
+Returns either nil or its argument if input is equal to argument]],
+    ['args_schema'] = {ts.string}
+  },
   -- Boolean function in, returns either nil or its input if input is in args list
   ['in'] = {
     ['types'] = {


More information about the Commits mailing list