We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0864898 commit 73e69feCopy full SHA for 73e69fe
lib/resty/libjwt.lua
@@ -21,6 +21,24 @@ function _M.get_params(params)
21
return result, ""
22
end
23
24
+
25
+function _M.split(str, sep)
26
+ if str == "" or str == nil then
27
+ return nil, "param is required"
28
+ end
29
+ if type(str) ~= "string" then
30
+ return nil, "param should be a string"
31
32
+ if type(sep) ~= "string" or sep == "" then
33
+ return nil, "separator should be a string"
34
35
+ local result = {}
36
+ for match in (str .. sep):gmatch("(.-)" .. sep) do
37
+ table.insert(result, match)
38
39
+ return result, ""
40
+end
41
42
function _M.validate(params)
43
local params, err = _M.get_params(params)
44
if err ~= "" then
0 commit comments