feat(hsm): first version of hsm library functional
This commit is contained in:
12 files changed
+1371
-46
No files matched your search
@@ -0,0 +1,24 @@
|
||||
---
|
||||
-- Determines if the provided timer value is valid.
|
||||
--
|
||||
-- A valid timer is defined as a number greater than zero.
|
||||
--
|
||||
-- @param x number: The timer value to validate.
|
||||
-- @return boolean: Returns `true` if `x` is a positive number; otherwise, returns `false` or `nil`.
|
||||
export is_valid_timer = (x) ->
|
||||
type(x) == "number" and x > 0
|
||||
|
||||
---
|
||||
-- Checks whether the given string is a valid symbol.
|
||||
--
|
||||
-- A valid symbol is defined as a non-empty string that contains only
|
||||
-- alphabetic characters (A-Z and a-z). If the input is not a string,
|
||||
-- the function returns `false`.
|
||||
--
|
||||
-- @param s string: The string to be validated as a symbol.
|
||||
-- @return boolean: Returns `true` if `s` contains only letters; otherwise, returns `false`.
|
||||
export is_valid_symbol = (s) ->
|
||||
if type(s) == "string" and string.match s, "^[A-Za-z][A-Za-z0-9_]*$"
|
||||
true
|
||||
else
|
||||
false
|
||||
Reference in new issue
Block a user