Function: map-contains-key

map-contains-key is a byte-compiled function defined in map.el.gz.

Signature

(map-contains-key MAP KEY)

Documentation

Return non-nil if and only if MAP contains KEY.

TESTFN is deprecated. Its default depends on MAP. The default implementation delegates to map-some.

Probably introduced at or before Emacs version 27.1.

Implementations

(map-contains-key (MAP hash-table) KEY &optional TESTFN) in `map.el'.

Return non-nil if MAP contains KEY, ignoring TESTFN.

(map-contains-key (MAP array) KEY &optional TESTFN) in `map.el'.

Return non-nil if KEY is an index of MAP, ignoring TESTFN.

(map-contains-key (MAP list) KEY &optional TESTFN) in `map.el'.

Return non-nil if MAP contains KEY. If MAP is an alist, TESTFN defaults to `equal'. If MAP is a plist, TESTFN defaults to `eq'.

(map-contains-key MAP KEY &optional TESTFN) in `map.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/map.el.gz
(cl-defgeneric map-contains-key (map key &optional testfn)
  ;; FIXME: The test function to use generally depends on the map object,
  ;; so specifying `testfn' here is problematic: e.g. for hash-tables
  ;; we shouldn't use `gethash' unless `testfn' is the same as the map's own
  ;; test function!
  "Return non-nil if and only if MAP contains KEY.
TESTFN is deprecated.  Its default depends on MAP.
The default implementation delegates to `map-some'."
  (declare (advertised-calling-convention (map key) "27.1"))
  (unless testfn (setq testfn #'equal))
  (map-some (lambda (k _v) (funcall testfn key k)) map))