aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-transient.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-10-04 13:47:38 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-10-04 13:47:38 +0200
commitd3f7046a083623d0e3788af00fc7006eee45fa3f (patch)
treef72e9cbded0aa9e56a58cd119625dd961379c2a6 /lisp/mastodon-transient.el
parent567b116357143488980e0294caf900624b48468a (diff)
transient: improve field-dot-to-array
Diffstat (limited to 'lisp/mastodon-transient.el')
-rw-r--r--lisp/mastodon-transient.el13
1 files changed, 1 insertions, 12 deletions
diff --git a/lisp/mastodon-transient.el b/lisp/mastodon-transient.el
index 4929a42..481a68e 100644
--- a/lisp/mastodon-transient.el
+++ b/lisp/mastodon-transient.el
@@ -69,18 +69,7 @@ the inner key part."
(defun mastodon-transient-field-dot-to-array (key)
"Convert KEY from tp dot annotation to array[key] annotation."
- (let* ((split (split-string key "\\."))
- (count (length split)))
- (cond ((not key) nil)
- ((= 1 count) key)
- (t
- (concat ;; first item
- (car split)
- "_attributes"
- ;; but last item
- "[" (car (last split (1- count)))
- ;; last item:
- "][" (car (last split)) "]")))))
+ (tp-dot-to-array key nil "_attributes"))
(defun mastodon-transient-dot-fields-to-arrays (alist)
"Parse fields ALIST in dot notation to array notation."