Liking cljdoc? Tell your friends :D
ClojureScript only.

citrus.cursor


reduce-cursor-incljs

(reduce-cursor-in ref path reducer & {:as options})

Given atom with deep nested value, path inside it and reducing function, creates an atom-like structure that can be used separately from main atom, but only for reading value:

(def state (atom {:users {"Ivan" {:children [1 2 3]}}})) (def ivan (citrus.cursor/reduce-cursor-in state [:users "Ivan" :children] last)) (deref ivan) ;; => 3

Returned value supports deref, watches and metadata. The only supported option is :meta

Given atom with deep nested value, path inside it and reducing function, creates an atom-like structure
 that can be used separately from main atom, but only for reading value:

   (def state (atom {:users {"Ivan" {:children [1 2 3]}}}))
   (def ivan (citrus.cursor/reduce-cursor-in state [:users "Ivan" :children] last))
   (deref ivan) ;; => 3

Returned value supports deref, watches and metadata.
The only supported option is `:meta`
sourceraw docstring

ReduceCursorcljs

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close