Liking cljdoc? Tell your friends :D
ClojureScript only.

taoensso.encore

Extended core library for Clojure/Script that emphasizes:

  • Cross platform API compatibility
  • Flexibility
  • Performance
  • Backwards compatibility

This lib's mostly for my own use and for advanced users that feel comfortable reading this source. Not providing much beginner-oriented documentation for this, sorry.

Quick Taoensso naming conventions: foo - Dynamic var. foo! - Fn with side effects, or that should otherwise be used cautiously. foo? - Truthy val or fn that returns truthy val. foo!? - Fn that has side effects (or requires caution) and that returns a truthy val. Note: !?, not ?!. foo$ - Fn that's notably expensive to compute (e.g. hits db). foo_ - Dereffable val (e.g. atom, volatile, delay, etc.). _ - Unnamed val. _foo - Named but unused val. ?foo - Optional val (emphasize that val may be nil). foo* - A variation of foo (e.g. foo* macro vs foo fn). -foo - Public implementation detail or intermediate (e.g. uncoerced) val.

foo - Val "to foo" (e.g. >sender, >host), or fn to put/coerce/transform. <foo - Val "from foo" (e.g. <sender, <host), or fn to take/coerce/transform. ->foo - Fn to put/coerce/transform.

Extended core library for Clojure/Script that emphasizes:
  * Cross platform API compatibility
  * Flexibility
  * Performance
  * Backwards compatibility

This lib's mostly for my own use and for advanced users that feel
comfortable reading this source. Not providing much beginner-oriented
documentation for this, sorry.

Quick Taoensso naming conventions:
  **foo** - Dynamic var.
  foo!    - Fn with side effects, or that should otherwise be used cautiously.
  foo?    - Truthy val or fn that returns truthy val.
  foo!?   - Fn that has side effects (or requires caution) and that returns
            a truthy val. Note: !?, not ?!.
  foo$    - Fn that's notably expensive to compute (e.g. hits db).
  foo_    - Dereffable val (e.g. atom, volatile, delay, etc.).
  _       - Unnamed val.
  _foo    - Named but unused val.
  ?foo    - Optional val (emphasize that val may be nil).
  foo*    - A variation of `foo` (e.g. `foo*` macro vs `foo` fn).
  -foo    - Public implementation detail or intermediate (e.g. uncoerced) val.
  >foo    - Val "to foo" (e.g. >sender, >host), or fn to put/coerce/transform.
  <foo    - Val "from foo" (e.g. <sender, <host), or fn to take/coerce/transform.
  ->foo   - Fn to put/coerce/transform.
raw docstring

*log-level*cljs

DEPRECATED

DEPRECATED
sourceraw docstring

->?singletoncljs

(->?singleton coll)
source

->veccljs

(->vec x)
source

-as-throwcljs

(-as-throw as-name x)
source

-assert-unstub-valcljs

(-assert-unstub-val f)
source

-cas!cljsmacro

(-cas! atom_ old-val new-val)

Micro optimization.

Micro optimization.
sourceraw docstring

-core-mergecljs

source

-core-update-incljs

source

-gc-now?cljsmacro

(-gc-now?)
source

-intern-stubcljsmacro

(-intern-stub ns stub-sym stub-var src)
source

-merge-withcljs

(-merge-with nest? f maps)
source

-new-stubfn_cljs

(-new-stubfn_ name)
source

-swap-cache!cljs

source

-swap-k!cljs

source

-swap-val!cljs

(-swap-val! atom_ k f)

Used internally by memoization utils.

Used internally by memoization utils.
sourceraw docstring

-unswappedcljs

source

-vol!cljsmacro

(-vol! val)
source

-vol-reset!cljsmacro

(-vol-reset! vol_ val)
source

-vol-swap!cljsmacro

(-vol-swap! vol_ f & args)
source

-vswappedcljs

source

<*cljsmacro

(<* x y z)
source

<=*cljsmacro

(<=* x y z)
source

>*cljsmacro

(>* x y z)
source

>=*cljsmacro

(>=* x y z)
source

?substr<idxcljs

source

?substr<lencljs

source

?subvec<idxcljs

source

?subvec<lencljs

source

a0-memoize_cljs

source

a1-memoize_cljs

source

abscljs

(abs n)
source

after-timeoutcljsmacro

(after-timeout msecs & body)

Alpha, subject to change. Returns a TimeoutFuture that will execute body after timeout. Body must be non-blocking or cheap.

Alpha, subject to change.
Returns a TimeoutFuture that will execute body after timeout.
Body must be non-blocking or cheap.
sourceraw docstring

ajax-litecljs

(ajax-lite uri
           {:keys [method params headers timeout-ms resp-type with-credentials?]
            :as opts
            :or {method :get timeout-ms 10000 resp-type :auto}}
           callback-fn)

Alpha, subject to change. Simple, lightweight Ajax via Google Closure. Returns the resulting XhrIo[1] instance, or nil.

(ajax-lite "/my-post-route" {:method :post :params {:username "Rich Hickey" :type "Awesome"} :headers {"Foo" "Bar"} :resp-type :text :timeout-ms 7000 :with-credentials? false ; Enable if using CORS (requires xhr v2+) } (fn async-callback-fn [resp-map] (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map] ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded ;; ?error - e/o #{nil <http-error-status-code> <exception> :timeout :abort :http-error :exception :xhr-pool-depleted} (js/alert (str "Ajax response: " resp-map)))))

[1] Ref. https://developers.google.com/closure/library/docs/xhrio

Alpha, subject to change. Simple, lightweight Ajax via Google Closure.
Returns the resulting XhrIo[1] instance, or nil.

(ajax-lite "/my-post-route"
  {:method     :post
   :params     {:username "Rich Hickey" :type "Awesome"}
   :headers    {"Foo" "Bar"}
   :resp-type  :text
   :timeout-ms 7000
   :with-credentials? false ; Enable if using CORS (requires xhr v2+)
  }
  (fn async-callback-fn [resp-map]
    (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map]
      ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded
      ;; ?error  - e/o #{nil <http-error-status-code> <exception> :timeout
                         :abort :http-error :exception :xhr-pool-depleted}
      (js/alert (str "Ajax response: " resp-map)))))

[1] Ref. https://developers.google.com/closure/library/docs/xhrio
sourceraw docstring

approx=cljs

(approx= x y)
(approx= x y signf)
source

approx==cljs

(approx== x y)
(approx== signf x y)
source

as-?boolcljs

(as-?bool x)
source

as-?emailcljs

(as-?email ?s)
source

as-?floatcljs

(as-?float x)
source

as-?intcljs

(as-?int x)
source

as-?kwcljs

(as-?kw x)
source

as-?namecljs

(as-?name x)
source

as-?nat-floatcljs

(as-?nat-float x)
source

as-?nat-intcljs

(as-?nat-int x)
source

as-?nblankcljs

(as-?nblank x)
source

as-?nemailcljs

(as-?nemail ?s)
source

as-?nempty-strcljs

(as-?nempty-str x)
source

as-?nzerocljs

(as-?nzero x)
source

as-?pfloatcljs

source

as-?pintcljs

source

as-?pos-floatcljs

(as-?pos-float x)
source

as-?pos-intcljs

(as-?pos-int x)
source

as-?pvalcljs

(as-?pval x)
source

as-?qnamecljs

(as-?qname x)
source

as-?udtcljs

(as-?udt x)
source

as-?ufloatcljs

source

as-?uintcljs

source

as-boolcljs

(as-bool x)
source

as-emailcljs

(as-email x)
source

as-floatcljs

(as-float x)
source

as-intcljs

(as-int x)
source

as-kwcljs

(as-kw x)
source

as-mapcljs

(as-map kvs & [kf vf])

Deprecated, prefer reduce-kvs

Deprecated, prefer `reduce-kvs`
sourceraw docstring

as-namecljs

(as-name x)
source

as-nat-floatcljs

(as-nat-float x)
source

as-nat-intcljs

(as-nat-int x)
source

as-nblankcljs

(as-nblank x)
source

as-nemailcljs

(as-nemail x)
source

as-nempty-strcljs

(as-nempty-str x)
source

as-nzerocljs

(as-nzero x)
source

as-pfloatcljs

source

as-pintcljs

source

as-pos-floatcljs

(as-pos-float x)
source

as-pos-intcljs

(as-pos-int x)
source

as-pvalcljs

(as-pval x)
source

as-qnamecljs

(as-qname x)
source

as-udtcljs

(as-udt x)
source

as-ufloatcljs

source

as-uintcljs

source

assert-min-encore-versioncljs

(assert-min-encore-version min-version)

Version check for dependency conflicts, etc.

Version check for dependency conflicts, etc.
sourceraw docstring

assoc-nxcljs

(assoc-nx m kvs)
(assoc-nx m k v)
(assoc-nx m k v & kvs)

Assocs each kv iff its key doesn't already exist.

Assocs each kv iff its key doesn't already exist.
sourceraw docstring

assoc-somecljs

(assoc-some m kvs)
(assoc-some m k v)
(assoc-some m k v & kvs)

Assocs each kv iff its value is not nil.

Assocs each kv iff its value is not nil.
sourceraw docstring

assoc-whencljs

(assoc-when m kvs)
(assoc-when m k v)
(assoc-when m k v & kvs)

Assocs each kv iff its val is truthy.

Assocs each kv iff its val is truthy.
sourceraw docstring

atom?cljs

(atom? x)
source

backport-run!cljs

source

benchcljsmacro

(bench nlaps opts & body)
source

boolean?cljs

(boolean? x)
source

call-after-timeoutcljs

(call-after-timeout msecs f)
(call-after-timeout impl_ msecs f)

Alpha, subject to change. Returns a TimeoutFuture that will execute f after given msecs.

Does NOT do any automatic binding conveyance.

Performance depends on the provided timer implementation (impl_). The default implementation offers O(logn) add, O(1) cancel, O(1) tick.

See ITimeoutImpl for extending to arbitrary timer implementations.

Alpha, subject to change.
Returns a TimeoutFuture that will execute `f` after given msecs.

Does NOT do any automatic binding conveyance.

Performance depends on the provided timer implementation (`impl_`).
The default implementation offers O(logn) add, O(1) cancel, O(1) tick.

See `ITimeoutImpl` for extending to arbitrary timer implementations.
sourceraw docstring

case-evalcljsmacro

(case-eval expr & clauses)

Like case but evals test constants for their compile-time value.

Like `case` but evals test constants for their compile-time value.
sourceraw docstring

catch-errorscljsmacro

(catch-errors & body)
source

catch-errors*cljsmacro

(catch-errors* & args)
source

catchingcljsmacro

(catching try-expr)
(catching try-expr error-sym catch-expr)
(catching try-expr error-sym catch-expr finally-expr)

Cross-platform try/catch/finally.

Cross-platform try/catch/finally.
sourceraw docstring

caught-error-datacljsmacro

(caught-error-data & body)

Handy for error-throwing unit tests.

Handy for error-throwing unit tests.
sourceraw docstring

chan?cljs

(chan? x)
source

check-allcljsmacro

(check-all test)
(check-all test & more)

Returns all logical false/throwing expressions (ids/forms), or nil.

Returns all logical false/throwing expressions (ids/forms), or nil.
sourceraw docstring

check-somecljsmacro

(check-some test)
(check-some test & more)

Returns first logical false/throwing expression (id/form), or nil.

Returns first logical false/throwing expression (id/form), or nil.
sourceraw docstring

clampcljs

(clamp nmin nmax n)
source

clamp*cljsmacro

(clamp* nmin nmax n)
source

clj1098cljs

(clj1098 x)
Ref. http://goo.gl/0GzRuz
sourceraw docstring

compile-ifcljsmacro

(compile-if test then)
(compile-if test then else)

Evaluates test. If it returns logical true (and doesn't throw), expands to then, otherwise expands to else.

Evaluates `test`. If it returns logical true (and doesn't throw), expands
to `then`, otherwise expands to `else`.
sourceraw docstring

compile-ns-filtercljs

Returns (fn [?ns]) -> truthy.

Returns (fn [?ns]) -> truthy.
sourceraw docstring

compile-whencljsmacro

(compile-when test & body)
source

condcljsmacro

(cond & clauses)

Like core/cond but supports implicit (final) else clause, and special test keywords: :else, :let, :do, :when, :when-not, :when-some. :let support inspired by https://github.com/Engelberg/better-cond.

Like `core/cond` but supports implicit (final) `else` clause, and special
test keywords: :else, :let, :do, :when, :when-not, :when-some.
:let support inspired by https://github.com/Engelberg/better-cond.
sourceraw docstring

cond!cljsmacro

(cond! & clauses)

Like cond but throws on non-match like case and condp.

Like `cond` but throws on non-match like `case` and `condp`.
sourceraw docstring

cond*cljsmacro

(cond* & args)
source

cond-throwcljsmacro

(cond-throw & args)
source

conj-somecljs

(conj-some)
(conj-some coll)
(conj-some coll x)
(conj-some coll x & more)

Conjoins each non-nil value.

Conjoins each non-nil value.
sourceraw docstring

conj-whencljs

(conj-when)
(conj-when coll)
(conj-when coll x)
(conj-when coll x & more)

Conjoins each truthy value.

Conjoins each truthy value.
sourceraw docstring

contains-in?cljs

(contains-in? coll ks)
(contains-in? coll ks k)
source

count-wordscljs

(count-words s)
source

debugfcljs

(debugf fmt & xs)
source

declare-remotecljsmacro

(declare-remote & syms)

Declares given ns-qualified symbols, preserving metadata. Useful for circular dependencies.

Declares given ns-qualified symbols, preserving metadata. Useful for
circular dependencies.
sourceraw docstring

defaliascljsmacro

(defalias src)
(defalias sym src)
(defalias sym src attrs)

Defines an alias for a var, preserving its metadata.

Defines an alias for a var, preserving its metadata.
sourceraw docstring

default-timeout-impl_cljs

Simple one-timeout timeout implementation provided by platform timer. O(logn) add, O(1) cancel, O(1) tick. Fns must be non-blocking or cheap. Similar efficiency to core.async timers (binary heap vs DelayQueue).

Simple one-timeout timeout implementation provided by platform timer.
O(logn) add, O(1) cancel, O(1) tick. Fns must be non-blocking or cheap.
Similar efficiency to core.async timers (binary heap vs DelayQueue).
sourceraw docstring

DefaultTimeoutImplcljs

source

defoncecljsmacro

(defonce sym & args)

Like core/defonce but supports optional docstring and attrs map.

Like `core/defonce` but supports optional docstring and attrs map.
sourceraw docstring

defonce*cljsmacro

(defonce* & args)
source

defstubcljsmacro

(defstub sym)

Experimental. Declares a stub var that can be initialized from any namespace with unstub-<stub-name>. Separates a var's declaration (location) and its initialization (value). Handy for defining vars in a shared ns from elsewhere (e.g. a private or cyclic ns).

Experimental. Declares a stub var that can be initialized from any
namespace with `unstub-<stub-name>`. Separates a var's declaration
(location) and its initialization (value). Handy for defining vars in a
shared ns from elsewhere (e.g. a private or cyclic ns).
sourceraw docstring

deprecatedcljsmacro

(deprecated & body)

Elides body when TAOENSSO_ELIDE_DEPRECATED sys val is truthy.

Elides body when `TAOENSSO_ELIDE_DEPRECATED` sys val is truthy.
sourceraw docstring

derefable?cljs

(derefable? x)
source

dissoc-incljs

(dissoc-in m ks dissoc-k)
(dissoc-in m ks dissoc-k & more)
source

distinct-bycljs

(distinct-by keyfn coll)

Deprecated, prefer xdistinct

Deprecated, prefer `xdistinct`
sourceraw docstring

distinct-elements?cljs

(distinct-elements? x)
source

distinctvcljs

(distinctv coll)
(distinctv keyfn coll)

Deprecated, prefer xdistinct

Deprecated, prefer `xdistinct`
sourceraw docstring

do-falsecljsmacro

(do-false & body)
source

do-nilcljsmacro

(do-nil & body)
source

do-truecljsmacro

(do-true & body)
source

doto-condcljsmacro

(doto-cond [sym x] & clauses)

Cross between doto, cond-> and as->.

Cross between `doto`, `cond->` and `as->`.
sourceraw docstring

dswap!cljs

source

editable?cljs

(editable? x)
source

encore-versioncljs

source

error-datacljs

(error-data x)

Returns data map iff x is an error of any type on platform.

Returns data map iff `x` is an error of any type on platform.
sourceraw docstring

error?cljs

(error? x)
source

errorfcljs

(errorf fmt & xs)
source

everycljs

source

exp-backoffcljs

(exp-backoff n-attempt)
(exp-backoff n-attempt {:keys [min max factor] :or {factor 1000}})

Returns binary exponential backoff value for n<=36.

Returns binary exponential backoff value for n<=36.
sourceraw docstring

expectcljsmacro

(expect expr)
(expect val expr)
(expect bindings val expr)
source

explode-keywordcljs

(explode-keyword k)
source

fatalfcljs

(fatalf fmt & xs)
source

filter-keyscljs

(filter-keys pred m)
source

filter-kvscljs

(filter-kvs pred m)
source

filter-valscljs

(filter-vals pred m)
source

float?cljs

(float? x)
source

force-refcljs

(force-ref x)

Like force for refs.

Like `force` for refs.
sourceraw docstring

formatcljs

(format fmt & args)

Like core/format but:

  • Returns "" when fmt is nil rather than throwing an NPE.
  • Formats nil as "nil" rather than "null".
  • Provides ClojureScript support via goog.string.format (this has fewer formatting options than Clojure's format!).
Like `core/format` but:
* Returns "" when fmt is nil rather than throwing an NPE.
* Formats nil as "nil" rather than "null".
* Provides ClojureScript support via goog.string.format (this has fewer
  formatting options than Clojure's `format`!).
sourceraw docstring

format*cljs

(format* fmt args)
source

format-query-stringcljs

(format-query-string m)
source

fq-namecljs

source

fzipmapcljs

(fzipmap ks vs)
source

get-envcljsmacro

(get-env)
source

get-substrcljs

(get-substr s start)
(get-substr s start end)

Like subs but provides consistent clj/s behaviour and never throws (snaps to valid start and end indexes).

Like `subs` but provides consistent clj/s behaviour and never throws
(snaps to valid start and end indexes).
sourceraw docstring

get-substringcljs

(get-substring s start)
(get-substring s start length)

Like get-substr but:

  • Takes length instead of end (index).
  • -ive start => index from right of string.
Like `get-substr` but:
- Takes `length` instead of `end` (index).
- -ive `start` => index from right of string.
sourceraw docstring

get-subveccljs

(get-subvec v start)
(get-subvec v start end)

Like subvec but never throws (snaps to valid start and end indexes).

Like `subvec` but never throws (snaps to valid start and end indexes).
sourceraw docstring

get-subvectorcljs

(get-subvector v start)
(get-subvector v start length)

Like get-subvec but:

  • Takes length instead of end (index).
  • -ive start => index from right of vector.
Like `get-subvec` but:
- Takes `length` instead of `end` (index).
- -ive `start` => index from right of vector.
sourceraw docstring

get-win-loccljs

(get-win-loc)

Returns js/window's current location as a map.

Returns `js/window`'s current location as a map.
sourceraw docstring

get-window-locationcljs

source

greatestcljs

(greatest coll & [?comparator])
source

havecljsmacro

(have pred (:in) x)
(have pred (:in) x & more-xs)

Takes a pred and one or more vals. Tests pred against each val, trapping errors. If any pred test fails, throws a detailed assertion error. Otherwise returns input val/vals for convenient inline-use/binding.

Respects assert value so tests can be elided from production for zero runtime costs.

Provides a small, simple, flexible feature subset to alternative tools like clojure.spec, core.typed, prismatic/schema, etc.

;; Will throw a detailed error message on invariant violation: (fn my-fn [x] (str/trim (have string? x)))

You may attach arbitrary debug info to assertion violations like: (have string? x :data {:my-arbitrary-debug-info "foo"})

See also have?, have!.

Takes a pred and one or more vals. Tests pred against each val,
trapping errors. If any pred test fails, throws a detailed assertion error.
Otherwise returns input val/vals for convenient inline-use/binding.

Respects *assert* value so tests can be elided from production for zero
runtime costs.

Provides a small, simple, flexible feature subset to alternative tools like
clojure.spec, core.typed, prismatic/schema, etc.

  ;; Will throw a detailed error message on invariant violation:
  (fn my-fn [x] (str/trim (have string? x)))

You may attach arbitrary debug info to assertion violations like:
  `(have string? x :data {:my-arbitrary-debug-info "foo"})`

See also `have?`, `have!`.
sourceraw docstring

have!cljsmacro

(have! pred (:in) x)
(have! pred (:in) x & more-xs)

Like have but ignores assert value (so can never be elided). Useful for important conditions in production (e.g. security checks).

Like `have` but ignores *assert* value (so can never be elided). Useful
for important conditions in production (e.g. security checks).
sourceraw docstring

have!?cljsmacro

(have!? pred (:in) x)
(have!? pred (:in) x & more-xs)

Specialized cross between have? and have!. Not used often but can be handy for semantic clarification and/or to improve multi-val performance when the return vals aren't necessary.

WARNING: Do NOT use in :pre/:post conds since those are ALWAYS subject to assert, directly contradicting the intention of the bang (!) here.

Specialized cross between `have?` and `have!`. Not used often but can be
handy for semantic clarification and/or to improve multi-val performance
when the return vals aren't necessary.

**WARNING**: Do NOT use in :pre/:post conds since those are ALWAYS subject
to *assert*, directly contradicting the intention of the bang (`!`) here.
sourceraw docstring

have-incljsmacro

(have-in a1 & an)
source

have-in!cljsmacro

(have-in! a1 & an)
source

have?cljsmacro

(have? pred (:in) x)
(have? pred (:in) x & more-xs)

Like have but returns true on successful tests. In particular, this can be handy for use with :pre/:post conditions. Compare: (fn my-fn [x] {:post [(have nil? %)]} nil) ; {:post [nil]} FAILS (fn my-fn [x] {:post [(have? nil? %)]} nil) ; {:post [true]} passes as intended

Like `have` but returns `true` on successful tests. In particular, this
can be handy for use with :pre/:post conditions. Compare:
  (fn my-fn [x] {:post [(have  nil? %)]} nil) ; {:post [nil]} FAILS
  (fn my-fn [x] {:post [(have? nil? %)]} nil) ; {:post [true]} passes as intended
sourceraw docstring

ident?cljs

(ident? x)
source

idx-fncljs

(idx-fn)

Returns a new stateful index fn that returns: 0, 1, 2, ...

Returns a new stateful index fn that returns: 0, 1, 2, ...
sourceraw docstring

if-cljcljsmacro

(if-clj then & [else])
source

if-cljscljsmacro

(if-cljs then & [else])
source

if-letcljsmacro

(if-let bindings then)
(if-let bindings then else)

Like core/if-let but can bind multiple values for then iff all tests are truthy, supports internal :lets.

Like `core/if-let` but can bind multiple values for `then` iff all tests
are truthy, supports internal `:let`s.
sourceraw docstring

if-letscljsmacro

(if-lets & args)
source

if-notcljsmacro

(if-not test-or-bindings then)
(if-not test-or-bindings then else)

Like core/if-not but acts like if-let when given a binding vector as test expr.

Like `core/if-not` but acts like `if-let` when given a binding vector
as test expr.
sourceraw docstring

if-not*cljsmacro

(if-not* & args)
source

if-somecljsmacro

(if-some bindings then)
(if-some bindings then else)

Like core/if-some but can bind multiple values for then iff all tests are non-nil, supports internal :lets.

Like `core/if-some` but can bind multiple values for `then` iff all tests
are non-nil, supports internal `:let`s.
sourceraw docstring

indexed?cljs

(indexed? x)
source

infofcljs

(infof fmt & xs)
source

int?cljs

(int? x)
source

interleave-allcljs

(interleave-all)
(interleave-all c1)
(interleave-all c1 c2)
(interleave-all c1 c2 & colls)

Greedy version of interleave.

Greedy version of `interleave`.
sourceraw docstring

into!cljs

(into! to from)
(into! to xform from)
source

into-allcljs

(into-all to from)
(into-all to from & more)

Like into but supports multiple "from"s.

Like `into` but supports multiple "from"s.
sourceraw docstring

into-strcljs

(into-str & xs)

Simple Hiccup-like string templating to complement Tempura.

Simple Hiccup-like string templating to complement Tempura.
sourceraw docstring

is!cljs

(is! x)
(is! pred x)
(is! pred x fail-?data)

Cheaper have! that provides less diagnostic info.

Cheaper `have!` that provides less diagnostic info.
sourceraw docstring

ITimeoutFuturecljsprotocol

tf-cancel!cljs

(tf-cancel! _)

Returns true iff the timeout was successfully cancelled (i.e. was previously pending).

Returns true iff the timeout was successfully cancelled (i.e. was previously pending).

tf-pollcljs

(tf-poll _)

Returns :timeout/pending, :timeout/cancelled, or the timeout's completed result.

Returns :timeout/pending, :timeout/cancelled, or the timeout's completed result.

tf-done?cljs

(tf-done? _)

Returns true iff the timeout is not pending (i.e. has a completed result or is cancelled).

Returns true iff the timeout is not pending (i.e. has a completed result or is cancelled).

tf-statecljs

(tf-state _)

Returns a map of timeout's public state.

Returns a map of timeout's public state.

tf-pending?cljs

(tf-pending? _)

Returns true iff the timeout is pending.

Returns true iff the timeout is pending.

tf-cancelled?cljs

(tf-cancelled? _)

Returns true iff the timeout is cancelled.

Returns true iff the timeout is cancelled.
source

ITimeoutImplcljsprotocol

-schedule-timeoutcljs

(-schedule-timeout _ msecs f)
source

join-oncecljs

(join-once sep & coll)
source

js-?wincljs

source

keys-bycljs

(keys-by f coll)

Returns {(f x) x} map for xs in coll.

Returns {(f x) x} map for xs in `coll`.
sourceraw docstring

keys<=cljs

(keys<= m ks)
source

keys=cljs

(keys= m ks)
source

keys=nnil?cljs

(keys=nnil? m ks)
source

keys>=cljs

(keys>= m ks)
source

keywordize-mapcljs

(keywordize-map m)
source

ks-nnil?cljs

(ks-nnil? ks m)
source

ks<=cljs

(ks<= ks m)
source

ks=cljs

(ks= ks m)
source

ks>=cljs

(ks>= ks m)
source

kw-identical?cljs

source

lazy-seq?cljs

(lazy-seq? x)
source

leastcljs

(least coll & [?comparator])
source

LimitEntrycljs

source

limitercljs

(limiter specs)

Takes {<spec-id> [<n-max-reqs> <msecs-window>]}, and returns a rate limiter (fn check-limits! [req-id]) -> nil (all limits pass), or [<worst-spec-id> <worst-backoff-msecs> {<spec-id> <backoff-msecs>}].

Limiter fn commands: :rl/peek <req-id> - Check limits w/o side effects. :rl/reset <req-id> - Reset all limits for given req-id.

Takes {<spec-id> [<n-max-reqs> <msecs-window>]}, and returns a rate
limiter (fn check-limits! [req-id]) -> nil (all limits pass), or
[<worst-spec-id> <worst-backoff-msecs> {<spec-id> <backoff-msecs>}].

Limiter fn commands:
  :rl/peek  <req-id> - Check limits w/o side effects.
  :rl/reset <req-id> - Reset all limits for given req-id.
sourceraw docstring

limiter*cljs

(limiter* specs)

Experimental. Like limiter but returns [<limiter> <state_>].

Experimental. Like `limiter` but returns [<limiter> <state_>].
sourceraw docstring

LimitHitscljs

source

LimitSpeccljs

source

logcljs

source

logfcljs

(logf fmt & xs)
source

logging-levelcljs

source

logpcljs

(logp & xs)
source

map-keyscljs

(map-keys f m)
source

map-kvscljs

(map-kvs kf vf m)

Deprecated, prefer reduce-kv

Deprecated, prefer `reduce-kv`
sourceraw docstring

map-valscljs

(map-vals f m)
source

mapplycljs

(mapply f & args)

Like apply but calls seq-kvs on final arg.

Like `apply` but calls `seq-kvs` on final arg.
sourceraw docstring

max*cljsmacro

(max* n1 n2)
source

max-longcljs

source

memoize*cljs

(memoize* f)
(memoize* ttl-ms f)
(memoize* cache-size ttl-ms f)

Like core/memoize but:

  • Often faster, depending on opts.
  • Prevents race conditions on writes.
  • Supports auto invalidation & gc with ttl-ms opt.
  • Supports cache size limit & gc with cache-size opt.
  • Supports invalidation by prepending args with :mem/del or :mem/fresh.
Like `core/memoize` but:
* Often faster, depending on opts.
* Prevents race conditions on writes.
* Supports auto invalidation & gc with `ttl-ms` opt.
* Supports cache size limit & gc with `cache-size` opt.
* Supports invalidation by prepending args with `:mem/del` or `:mem/fresh`.
sourceraw docstring

memoize-1cljs

source

memoize-a0_cljs

source

memoize-a1_cljs

source

memoize-lastcljs

(memoize-last f)

Like memoize but only caches the fn's most recent call. Great for Reactjs render op caching on mobile devices, etc.

Like `memoize` but only caches the fn's most recent call.
Great for Reactjs render op caching on mobile devices, etc.
sourceraw docstring

memoize1cljs

source

memoize_cljs

(memoize_ f)

Like core/memoize but faster, non-racy, and supports invalidation.

Like `core/memoize` but faster, non-racy, and supports invalidation.
sourceraw docstring

memoizedcljs

(memoized cache f & args)
source

mergecljs

(merge & maps)

Like core/merge but faster, supports :swap/dissoc rvals.

Like `core/merge` but faster, supports `:swap/dissoc` rvals.
sourceraw docstring

merge-deepcljs

source

merge-deep-withcljs

source

merge-keywordscljs

(merge-keywords ks)
(merge-keywords ks omit-slash?)
source

merge-metacljs

(merge-meta x m)
source

merge-url-with-query-stringcljs

(merge-url-with-query-string url m)
source

merge-withcljs

(merge-with f & maps)

Like core/merge-with but faster, supports :swap/dissoc rvals.

Like `core/merge-with` but faster, supports `:swap/dissoc` rvals.
sourceraw docstring

min*cljsmacro

(min* n1 n2)
source

min-longcljs

source

mscljs

(ms & {:as opts :keys [years months weeks days hours mins secs msecs ms]})

Returns ~number of milliseconds in period defined by given args.

Returns ~number of milliseconds in period defined by given args.
sourceraw docstring

ms->secscljs

(ms->secs ms)
source

name-with-attrscljs

(name-with-attrs sym args)
(name-with-attrs sym args attrs-merge)

Given a symbol and args, returns [<name-with-attrs-meta> <args>] with support for defn style ?docstring and ?attrs-map.

Given a symbol and args, returns [<name-with-attrs-meta> <args>] with
support for `defn` style `?docstring` and `?attrs-map`.
sourceraw docstring

named?cljs

(named? x)
source

nano-timecljs

source

nano-time*cljsmacro

(nano-time* & args)
source

nat-float?cljs

(nat-float? x)
source

nat-int?cljs

(nat-int? x)
source

nat-num?cljs

(nat-num? x)
source

nblank-str?cljs

(nblank-str? x)
source

nblank?cljs

(nblank? x)
source

neg-float?cljs

(neg-float? x)
source

neg-int?cljs

(neg-int? x)
source

neg-num?cljs

(neg-num? x)
source

nempty-str?cljs

(nempty-str? x)
source

nested-mergecljs

(nested-merge & maps)

Like merge but does nested merging.

Like `merge` but does nested merging.
sourceraw docstring

nested-merge-withcljs

(nested-merge-with f & maps)

Like merge-with but does nested merging.

Like `merge-with` but does nested merging.
sourceraw docstring

new-objectcljsmacro

(new-object)
source

nil->sentinelcljs

(nil->sentinel x)
source

nil->strcljs

(nil->str x)

nil/undefined -> "nil"

nil/undefined -> "nil"
sourceraw docstring

nneg-float?cljs

source

nneg-int?cljs

source

nneg-num?cljs

source

nneg?cljs

(nneg? x)
source

nnilcljs

(nnil)
(nnil x)
(nnil x y)
(nnil x y z)
(nnil x y z & more)

Returns first non-nil arg, or nil.

Returns first non-nil arg, or nil.
sourceraw docstring

nnil-setcljs

(nnil-set x)
source

nnil=cljs

source

nnil?cljs

source

node-target?cljs

source

norm-word-breakscljs

(norm-word-breaks s)

Converts all word breaks of any form and length (including line breaks of any form, tabs, spaces, etc.) to a single regular space.

Converts all word breaks of any form and length (including line breaks of any
form, tabs, spaces, etc.) to a single regular space.
sourceraw docstring

now-dtcljs

(now-dt)
source

now-dt*cljsmacro

(now-dt*)
source

now-nanocljs

Uses window context as epoch, Ref. http://goo.gl/mWZWnR

Uses window context as epoch, Ref. http://goo.gl/mWZWnR
sourceraw docstring

now-nano*cljsmacro

(now-nano*)
source

now-udtcljs

(now-udt)
source

now-udt*cljsmacro

(now-udt*)
source

nvec?cljs

(nvec? n x)
source

ogetcljs

(oget o k)
(oget o k not-found)

Like get for JS objects, Ref. https://goo.gl/eze8hY.

Like `get` for JS objects, Ref. https://goo.gl/eze8hY.
sourceraw docstring

oget-incljs

(oget-in o ks)
(oget-in o ks not-found)

Like get-in for JS objects.

Like `get-in` for JS objects.
sourceraw docstring

parse-boolcljs

source

parse-floatcljs

source

parse-intcljs

source

parse-query-paramscljs

(parse-query-params s & [keywordize? encoding])

Based on ring-codec/form-decode.

Based on `ring-codec/form-decode`.
sourceraw docstring

parse-versioncljs

(parse-version x)
source

pathcljs

(path & parts)
source

pint?cljs

source

pos-float?cljs

(pos-float? x)
source

pos-int?cljs

(pos-int? x)
source

pos-num?cljs

(pos-num? x)
source

powcljs

(pow n exp)
source

pr-edncljs

(pr-edn x)
(pr-edn _opts x)

Prints arg to an edn string readable with read-edn.

Prints arg to an edn string readable with `read-edn`.
sourceraw docstring

preserve-reducedcljs

(preserve-reduced rf)

As core/preserving-reduced.

As `core/preserving-reduced`.
sourceraw docstring

pull-val!cljs

(pull-val! atom_ k)
(pull-val! atom_ k not-found)

Removes and returns value mapped to key.

Removes and returns value mapped to key.
sourceraw docstring

pval?cljs

(pval? x)
source

qbcljsmacro

(qb & args)
source

qbenchcljsmacro

(qbench & args)
source

qnamecljs

source

qualified-ident?cljs

(qualified-ident? x)
source

qualified-keyword?cljs

(qualified-keyword? x)
source

qualified-symbol?cljs

(qualified-symbol? x)
source

queuecljs

(queue)
(queue coll)

Returns a PersistentQueue.

Returns a PersistentQueue.
sourceraw docstring

queue*cljs

(queue* & items)
source

queue?cljs

(queue? x)
source

quick-benchcljsmacro

(quick-bench nlaps form)
(quick-bench nlaps form & more)

Returns fastest of 3 sets of times for each form, in msecs.

Returns fastest of 3 sets of times for each form, in msecs.
sourceraw docstring

rate-limitcljs

(rate-limit specs f)
source

rate-limitedcljs

(rate-limited ncalls-limit window-ms f)
source

rate-limitercljs

(rate-limiter ncalls-limit window-ms)
source

rate-limiter*cljs

(rate-limiter* specs)

Deprecated, prefer limiter

Deprecated, prefer `limiter`
sourceraw docstring

rcomparecljs

(rcompare x y)

Reverse comparator.

Reverse comparator.
sourceraw docstring

re-pattern?cljs

(re-pattern? x)
source

read-edncljs

(read-edn s)
(read-edn opts s)

Attempts to pave over differences in: clojure.edn/read-string, clojure.tools.edn/read-string, cljs.reader/read-string, cljs.tools.reader/read-string. cljs.reader in particular can be a pain.

Attempts to pave over differences in:
 `clojure.edn/read-string`, `clojure.tools.edn/read-string`,
 `cljs.reader/read-string`, `cljs.tools.reader/read-string`.
`cljs.reader` in particular can be a pain.
sourceraw docstring

reduce-indexedcljs

(reduce-indexed rf init coll)

Like reduce but takes (rf [acc idx in]) with idx as in map-indexed.

Like `reduce` but takes (rf [acc idx in]) with idx as in `map-indexed`.
sourceraw docstring

reduce-kvscljs

(reduce-kvs rf init kvs)

Like reduce-kv but takes a flat sequence of kv pairs.

Like `reduce-kv` but takes a flat sequence of kv pairs.
sourceraw docstring

reduce-ncljs

(reduce-n rf init n)
source

reduce-objcljs

(reduce-obj f init o)

Like reduce-kv but for JavaScript objects.

Like `reduce-kv` but for JavaScript objects.
sourceraw docstring

reduce-topcljs

(reduce-top n rf init coll)
(reduce-top n keyfn rf init coll)
(reduce-top n keyfn cmp rf init coll)

Reduces the top n items from coll of N items into in O(N.logn) time. For comparsion, (take n (sort-by ...)) is O(N.logN).

Reduces the top `n` items from `coll` of N items into in O(N.logn) time.
For comparsion, (take n (sort-by ...)) is O(N.logN).
sourceraw docstring

regular-num?cljs

(regular-num? x)
source

remove-keyscljs

(remove-keys pred m)
source

remove-kvscljs

(remove-kvs pred m)
source

remove-valscljs

(remove-vals pred m)
source

removevcljs

(removev pred coll)
source

repeatedly*cljsmacro

(repeatedly* n & body)
source

repeatedly-intocljs

(repeatedly-into coll n f)

Like repeatedly but faster and conjs items into given collection.

Like `repeatedly` but faster and `conj`s items into given collection.
sourceraw docstring

repeatedly-into*cljsmacro

(repeatedly-into* coll n & body)

Deprecated

Deprecated
sourceraw docstring

replace-incljs

(replace-in m & ops)
source

reportfcljs

(reportf fmt & xs)
source

reset-in!cljs

(reset-in! atom_ val)
(reset-in! atom_ ks val)
(reset-in! atom_ ks not-found val)

Like reset! but supports update-in semantics, returns <old-key-val>.

Like `reset!` but supports `update-in` semantics,
returns <old-key-val>.
sourceraw docstring

reset-val!cljs

(reset-val! atom_ k val)
(reset-val! atom_ k not-found val)

Low-level util, returns <old-key-val>.

Low-level util, returns <old-key-val>.
sourceraw docstring

reset-val!?cljs

(reset-val!? atom_ k new-val)

Maps value to key and returns true iff the mapped value changed or was created.

Maps value to key and returns true iff the mapped value changed or
was created.
sourceraw docstring

reverycljs

(revery pred coll)
source

revery-kvcljs

(revery-kv pred coll)
source

revery-kv?cljs

(revery-kv? pred coll)
source

revery?cljs

(revery? pred coll)
source

rfirstcljs

(rfirst pred coll)
source

rfirst-kvcljs

(rfirst-kv pred coll)
source

roundcljs

(round n & [type nplaces])
source

round*cljs

(round* n)
(round* type n)
(round* type nplaces n)
source

round0cljs

(round0 n)
source

round1cljs

(round1 n)
source

round2cljs

(round2 n)
source

rsomecljs

(rsome pred coll)
source

rsome-kvcljs

(rsome-kv pred coll)
source

run!cljs

(run! proc coll)
source

run!*cljs

source

run-kv!cljs

(run-kv! proc m)
source

run-kvs!cljs

(run-kvs! proc kvs)
source

run-obj!cljs

(run-obj! proc obj)
source

sayfcljs

(sayf fmt & xs)
source

saypcljs

(sayp & xs)
source

sb-appendcljs

(sb-append str-builder s)
(sb-append str-builder s & more)

For cross-platform string building

For cross-platform string building
sourceraw docstring

secscljs

source

secs->mscljs

(secs->ms secs)
source

sentinelcljs

source

sentinel->nilcljs

(sentinel->nil x)
source

sentinel?cljs

(sentinel? x)
source

seq-kvscljs

(seq-kvs {:a :A}) => (:a :A).

(seq-kvs {:a :A}) => (:a :A).
sourceraw docstring

set*cljs

source

set-exp-backoff-timeout!cljs

(set-exp-backoff-timeout! nullary-f & [nattempt])
source

simple-ident?cljs

(simple-ident? x)
source

simple-keyword?cljs

(simple-keyword? x)
source

simple-symbol?cljs

(simple-symbol? x)
source

SimpleCacheEntrycljs

source

singleton?cljs

(singleton? coll)
source

some=cljs

(some= x y)
(some= x y & more)
source

some?cljs

(some? x)
source

spaced-strcljs

(spaced-str xs)
source

spaced-str-with-nilscljs

(spaced-str-with-nils xs)
source

str-?indexcljs

(str-?index s substr)
(str-?index s substr start-idx)
(str-?index s substr start-idx last?)
source

str-buildercljs

For cross-platform string building

For cross-platform string building
sourceraw docstring

str-builder?cljs

(str-builder? x)
source

str-contains?cljs

(str-contains? s substr)
source

str-ends-with?cljs

(str-ends-with? s substr)
source

str-joincljs

(str-join coll)
(str-join separator coll)
(str-join separator xform coll)

Faster, transducer-based generalization of clojure.string/join with xform support

Faster, transducer-based generalization of `clojure.string/join` with `xform`
support
sourceraw docstring

str-join-oncecljs

(str-join-once separator coll)

Like string/join but skips duplicate separators.

Like `string/join` but skips duplicate separators.
sourceraw docstring

str-replacecljs

(str-replace s match replacement)

Like str/replace but provides consistent clj/s behaviour.

Workaround for http://dev.clojure.org/jira/browse/CLJS-794, http://dev.clojure.org/jira/browse/CLJS-911.

Note that ClojureScript 1.7.145 introduced a partial fix for CLJS-911. A full fix could unfortunately not be introduced w/o breaking compatibility with the previously incorrect behaviour. CLJS-794 also remains unresolved.

Like `str/replace` but provides consistent clj/s behaviour.

Workaround for http://dev.clojure.org/jira/browse/CLJS-794,
               http://dev.clojure.org/jira/browse/CLJS-911.

Note that ClojureScript 1.7.145 introduced a partial fix for CLJS-911.
A full fix could unfortunately not be introduced w/o breaking compatibility
with the previously incorrect behaviour. CLJS-794 also remains unresolved.
sourceraw docstring

str-rfcljs

String builder reducing fn

String builder reducing fn
sourceraw docstring

str-starts-with?cljs

(str-starts-with? s substr)
source

stringy?cljs

(stringy? x)
source

sub-indexescljs

(sub-indexes x start-idx & {:keys [max-len end-idx]})
source

substrcljs

(substr s start-idx & [?max-len])

Deprecated, prefer get-substr or get-substring

Deprecated, prefer `get-substr` or `get-substring`
sourceraw docstring

subvec*cljs

(subvec* v start-idx & [?max-len])

Deprecated, prefer get-subvec or get-subvector

Deprecated, prefer `get-subvec` or `get-subvector`
sourceraw docstring

swap!*cljs

source

swap-in!cljs

(swap-in! atom_ f)
(swap-in! atom_ ks f)
(swap-in! atom_ ks not-found f)

Like swap! but supports update-in semantics, returns <new-key-val> or <swapped-return-val>.

Like `swap!` but supports `update-in` semantics,
returns <new-key-val> or <swapped-return-val>.
sourceraw docstring

swap-in!*cljs

(swap-in!* atom_ f)
(swap-in!* atom_ ks f)
(swap-in!* atom_ ks not-found f)

Like swap! but supports update-in semantics, returns [<old-key-val> <new-key-val>].

Like `swap!` but supports `update-in` semantics,
returns [<old-key-val> <new-key-val>].
sourceraw docstring

swap-val!cljs

(swap-val! atom_ k f)
(swap-val! atom_ k not-found f)

Low-level util, returns <new-key-val> or <swapped-return-val>.

Low-level util, returns <new-key-val> or <swapped-return-val>.
sourceraw docstring

swap-val!*cljs

(swap-val!* atom_ k f)
(swap-val!* atom_ k not-found f)

Low-level util, returns [<old-key-val> <new-key-val>].

Low-level util, returns [<old-key-val> <new-key-val>].
sourceraw docstring

swappedcljs

(swapped new-val return-val)
source

Swappedcljs

source

swapped*cljs

source

swapped-veccljs

(swapped-vec x)
source

swapped?cljs

(swapped? x)
source

takevcljs

(takev n coll)
source

thread-local-proxycljsmacro

(thread-local-proxy & body)
source

TickedCacheEntrycljs

source

time-mscljsmacro

(time-ms & body)

Returns number of milliseconds it took to execute body.

Returns number of milliseconds it took to execute body.
sourceraw docstring

time-nscljsmacro

(time-ns & body)

Returns number of nanoseconds it took to execute body.

Returns number of nanoseconds it took to execute body.
sourceraw docstring

timeout-future?cljs

(timeout-future? x)
source

TimeoutFuturecljs

source

topcljs

(top n coll)
(top n keyfn coll)
(top n keyfn cmp coll)

Returns a sorted vector of the top n items from coll using reduce-top.

Returns a sorted vector of the top `n` items from `coll` using `reduce-top`.
sourceraw docstring

top-intocljs

(top-into to n coll)
(top-into to n keyfn coll)
(top-into to n keyfn cmp coll)

Conjoins the top n items from coll into to using reduce-top.

Conjoins the top `n` items from `coll` into `to` using `reduce-top`.
sourceraw docstring

tracefcljs

(tracef fmt & xs)
source

udt?cljs

(udt? x)
source

uint?cljs

source

undefined->nilcljs

(undefined->nil x)
source

update-incljs

(update-in m ks f)
(update-in m ks not-found f)

Like core/update-in but resolves an ambiguity with empty ks, adds support for not-found, :swap/dissoc vals.

Like `core/update-in` but resolves an ambiguity with empty `ks`,
adds support for `not-found`, `:swap/dissoc` vals.
sourceraw docstring

update-in*cljs

source

url-decodecljs

(url-decode s & [encoding])
Stolen from http://goo.gl/99NSR1
sourceraw docstring

url-encodecljs

(url-encode s)
Stolen from http://goo.gl/99NSR1
sourceraw docstring

use-fixturescljsmacro

(use-fixtures fixture-type & fixtures)

Cross-platform test/use-fixtures

Cross-platform `test/use-fixtures`
sourceraw docstring

use-fixtures*cljsmacro

(use-fixtures* & args)
source

uuid-strcljs

(uuid-str)
(uuid-str max-length)

Returns a UUIDv4 string of form "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx". Ref. http://www.ietf.org/rfc/rfc4122.txt, https://gist.github.com/franks42/4159427

Returns a UUIDv4 string of form "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".
Ref. http://www.ietf.org/rfc/rfc4122.txt,
     https://gist.github.com/franks42/4159427
sourceraw docstring

vec*cljs

source

vec2?cljs

(vec2? x)
source

vec3?cljs

(vec3? x)
source

vinterleave-allcljs

(vinterleave-all c1 c2)
source

vnextcljs

(vnext v)
source

vrestcljs

(vrest v)
source

vsplit-firstcljs

(vsplit-first v)
source

vsplit-lastcljs

(vsplit-last v)
source

warnfcljs

(warnf fmt & xs)
source

whencljsmacro

(when test-or-bindings & body)

Like core/when but acts like when-let when given a binding vector as test expr.

Like `core/when` but acts like `when-let` when given a binding vector
as test expr.
sourceraw docstring

when-letcljsmacro

(when-let bindings & body)

Like core/when-let but can bind multiple values for body iff all tests are truthy, supports internal :lets.

Like `core/when-let` but can bind multiple values for `body` iff all tests
are truthy, supports internal `:let`s.
sourceraw docstring

when-letscljsmacro

(when-lets & args)
source

when-notcljsmacro

(when-not test-or-bindings & body)

Like core/when-not but acts like when-let when given a binding vector as test expr.

Like `core/when-not` but acts like `when-let` when given a binding vector
as test expr.
sourceraw docstring

when-somecljsmacro

(when-some test-or-bindings & body)
source

when?cljs

(when? pred x)
source

with-dynamic-assertion-datacljsmacro

(with-dynamic-assertion-data data & body)

Executes body with dynamic assertion data bound to given value. This data will be included in any violation errors thrown by body.

Executes body with dynamic assertion data bound to given value.
This data will be included in any violation errors thrown by body.
sourceraw docstring

without-metacljs

(without-meta x)
source

xdistinctcljs

(xdistinct)
(xdistinct keyfn)
source

zero-num?cljs

(zero-num? x)
source

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

× close