get

functionsince v0.0-927 clojure.core/getEdit
(get o k)
(get o k not-found)

Details:

Returns the value mapped to key k.

Returns not-found or nil if k is not present in o.


See Also:


Source docstring:
Returns the value mapped to key, not-found or nil if key not present
in associative collection, set, string, array, or ILookup instance.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn get
  ([o k]
    (when-not (nil? o)
      (cond
        (implements? ILookup o)
        (-lookup o k)

        (array? o)
        (when (and (some? k) (< k (.-length o)))
          (aget o (int k)))

        (string? o)
        (when (and (some? k) (< -1 k (.-length o)))
          (.charAt o (int k)))

        (native-satisfies? ILookup o)
        (-lookup o k)

        :else nil)))
  ([o k not-found]
    (if-not (nil? o)
      (cond
        (implements? ILookup o)
        (-lookup o k not-found)

        (array? o)
        (if (and (some? k) (< -1 k (.-length o)))
          (aget o (int k))
          not-found)

        (string? o)
        (if (and (some? k) (< -1 k (.-length o)))
          (.charAt o (int k))
          not-found)

        (native-satisfies? ILookup o)
        (-lookup o k not-found)

        :else not-found)
      not-found)))