function
boot.janet on line 1615 , column 1
(get-in ds ks &opt dflt )
Access a value in a nested data structure. Looks into the data
structure via a sequence of keys. If value is not found , and `dflt`
is provided , returns `dflt` .
(get-in {:a {:cc 2 } :b {:dd 3 }} [:a ] 42 ) # => {:cc 2}
(get-in {:a {:cc 2 } :b {:dd 3 }} [:a :cc ] 42 ) # => 2
(get-in {:a {:cc 2 } :b {:dd 3 }} [0 ] 42 ) # => 42
(get-in {:a {:cc 2 } :b {:dd 3 }} [:z ] 42 ) # => 42
(get-in [[4 5 ] [6 7 ]] [0 ] 42 ) # => (4 5)
(get-in [[4 5 ] [6 7 ]] [0 1 ] 42 ) # => 5
(get-in [[4 5 ] [6 7 ]] [-1 ] 42 ) # => 42
(get-in [[4 5 ] [6 7 ]] [9 9 9 ] 42 ) # => 42
(def request {:params {:id 1 }}) # => {:params {:id 1}}
(get-in request [:params :id ]) # => 1
(get-in request [:params :name ]) # => nil
(get-in request [:params :name ] "N/A" ) # => "N/A"