summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:20:18 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:20:18 +0200
commit90c2775f05adcc870758a5ac4ae7b8d51ce9d1d9 (patch)
treec1008d6433c5d3b6f9e6733bea3a958ba720a49c
parent1ea40b35feb7fd710c7621058bb25bd14356e80a (diff)
Add gnosis-assert-float-or-nil
-rw-r--r--gnosis.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 6913cdf..fdf7516 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1242,6 +1242,14 @@ Insert deck values `ef-increase', `ef-decrease', `ef-threshold', `failure-factor
(unless (or (null value) (integerp value))
(error "Invalid value: %s, %s" value description)))
+(defun gnosis-assert-float-or-nil (value description &optional less-than-1)
+ "Assert that VALUE is a float or nil."
+ (if less-than-1
+ (unless (or (null value) (and (floatp value) (< value 1)))
+ (error "Invalid value: %s, %s" value description))
+ (unless (or (null value) (floatp value))
+ (error "Invalid value: %s, %s" value description))))
+
(cl-defun gnosis-edit-save-exit (&optional deck-edit (exit-func 'exit-recursive-edit) &rest args)
"Save edits and exit.