Function: -map-when

-map-when is a byte-compiled function defined in dash.el.

Signature

(-map-when PRED REP LIST)

Documentation

Use PRED to conditionally apply REP to each item in LIST.

Return a copy of LIST where the items for which PRED returns nil are unchanged, and the rest are mapped through the REP function.

Alias: -replace-where

See also: -update-at

View in manual

Aliases

-replace-where

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -map-when (pred rep list)
  "Use PRED to conditionally apply REP to each item in LIST.
Return a copy of LIST where the items for which PRED returns nil
are unchanged, and the rest are mapped through the REP function.

Alias: `-replace-where'

See also: `-update-at'"
  (declare (important-return-value t))
  (--map-when (funcall pred it) (funcall rep it) list))