Function: dash--match-kv-1

dash--match-kv-1 is a byte-compiled function defined in dash.el.

Signature

(dash--match-kv-1 MATCH-FORM SOURCE TYPE)

Documentation

Match MATCH-FORM against SOURCE of type TYPE.

MATCH-FORM is a proper list of the form (key1 place1 ... keyN placeN). Each placeK is either a symbol, which gets bound to the value of keyK retrieved from the key-value store, or another match form which gets destructured recursively.

SOURCE is a key-value store of type TYPE, which can be a plist, an alist or a hash table.

TYPE is a token specifying the type of the key-value store. Valid values are &plist, &alist and &hash.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun dash--match-kv-1 (match-form source type)
  "Match MATCH-FORM against SOURCE of type TYPE.

MATCH-FORM is a proper list of the form (key1 place1 ... keyN
placeN).  Each placeK is either a symbol, which gets bound to the
value of keyK retrieved from the key-value store, or another
match form which gets destructured recursively.

SOURCE is a key-value store of type TYPE, which can be a plist,
an alist or a hash table.

TYPE is a token specifying the type of the key-value store.
Valid values are &plist, &alist and &hash."
  (-flatten-n 1 (-map
                 (lambda (kv)
                   (let* ((k (car kv))
                          (v (cadr kv))
                          (getter
                           (funcall (dash--get-expand-function type) k source)))
                     (cond
                      ((symbolp v)
                       (list (list v getter)))
                      (t (dash--match v getter)))))
                 (-partition 2 match-form))))