Liking cljdoc? Tell your friends :D

re-com.util


->vcljs

(->v x)

add-map-to-hiccup-callcljs

(add-map-to-hiccup-call map hiccup)

assoc-in-if-emptycljs

(assoc-in-if-empty m ks v)

Only assoc-in if no value exists at ks

Only assoc-in if no value exists at ks
raw docstring

clipboard-write!cljs

(clipboard-write! s)

combine-csscljs

(combine-css a b)

deep-mergecljs

(deep-merge & vals)

Recursively merges maps. If vals are not maps, the last value wins.

Recursively merges maps. If vals are not maps, the last value wins.
raw docstring

deref-or-valuecljs

(deref-or-value val-or-atom)

Takes a value or an atom If it's a value, returns it If it's an object that supports IDeref, returns the value inside it by derefing

Takes a value or an atom
If it's a value, returns it
If it's an object that supports IDeref, returns the value inside it by derefing
raw docstring

deref-or-value-peekcljs

(deref-or-value-peek val-or-atom)

Takes a value or an atom If it's a value, returns it If it's a Reagent object that supports IDeref, returns the value inside it, but WITHOUT derefing

The arg validation code uses this, since calling deref-or-value adds this arg to the watched ratom list for the component in question, which in turn can cause different rendering behaviour between dev (where we validate) and prod (where we don't).

This was experienced in popover-content-wrapper with the position-injected atom which was not derefed there, however the dev-only validation caused it to be derefed, modifying its render behaviour and causing mayhem and madness for the developer.

See below that different Reagent types have different ways of retrieving the value without causing capture, although in the case of Track, we just deref it as there is no peek or state, so hopefully this won't cause issues (surely this is used very rarely).

Takes a value or an atom
If it's a value, returns it
If it's a Reagent object that supports IDeref, returns the value inside it, but WITHOUT derefing

The arg validation code uses this, since calling deref-or-value adds this arg to the watched ratom list for the component
in question, which in turn can cause different rendering behaviour between dev (where we validate) and prod (where we don't).

This was experienced in popover-content-wrapper with the position-injected atom which was not derefed there, however
the dev-only validation caused it to be derefed, modifying its render behaviour and causing mayhem and madness for the developer.

See below that different Reagent types have different ways of retrieving the value without causing capture, although in the case of
Track, we just deref it as there is no peek or state, so hopefully this won't cause issues (surely this is used very rarely).
raw docstring

enumeratecljs

(enumerate coll)

(for [[index item first? last?] (enumerate coll)] ...)

(for [[index item first? last?] (enumerate coll)] ...)
raw docstring

fetch-merged-csscljs

(fetch-merged-css tag)
(fetch-merged-css tag options)

flatten-attrcljs

(flatten-attr stuff)

fmapcljs

(fmap f m)

Takes a function 'f' amd a map 'm'. Applies 'f' to each value in 'm' and returns. (fmap inc {:a 4 :b 2}) => {:a 5 :b 3}

Takes a function 'f' amd a map 'm'.  Applies 'f' to each value in 'm' and returns.
(fmap  inc  {:a 4  :b 2})   =>   {:a 5  :b 3}
raw docstring

get-element-by-idcljs

(get-element-by-id id)

insert-nthcljs

(insert-nth vect index item)

item-for-idcljs

(item-for-id id v & {:keys [id-fn] :or {id-fn :id}})

Takes a vector of maps 'v'. Returns the first item in 'v' whose id-fn (default :id) matches 'id'. Returns nil if id not found

Takes a vector of maps 'v'. Returns the first item in 'v' whose id-fn (default :id) matches 'id'.
Returns nil if id not found
raw docstring

merge-csscljs

(merge-css css-desc {:as params :keys [class style attr parts]})

now->utccljs

(now->utc)

Return a goog.date.UtcDateTime based on local date/time.

Return a goog.date.UtcDateTime based on local date/time.
raw docstring

pad-zerocljs

(pad-zero s len)

Left pad a string 's' with '0', until 's' has length 'len'. Return 's' unchanged, if it is already len or greater

Left pad a string 's' with '0', until 's' has length 'len'. Return 's' unchanged, if it is already len or greater
raw docstring

pad-zero-numbercljs

(pad-zero-number num len)

return 'num' as a string of 'len' characters, left padding with '0' as necessary

return 'num' as a string of 'len' characters, left padding with '0' as necessary
raw docstring

pluralizecljs

(pluralize num singular & [plural])

Return a pluralized phrase, appending an s to the singular form if no plural is provided. For example: (pluralize 5 "month") => "5 months" (pluralize 1 "month") => "1 month" (pluralize 1 "radius" "radii") => "1 radius" (pluralize 9 "radius" "radii") => "9 radii" From https://github.com/flatland/useful/blob/194950/src/flatland/useful/string.clj#L25-L33

Return a pluralized phrase, appending an s to the singular form if no plural is provided.
For example:
   (pluralize 5 "month") => "5 months"
   (pluralize 1 "month") => "1 month"
   (pluralize 1 "radius" "radii") => "1 radius"
   (pluralize 9 "radius" "radii") => "9 radii"
   From https://github.com/flatland/useful/blob/194950/src/flatland/useful/string.clj#L25-L33
raw docstring

position-for-idcljs

(position-for-id id v & {:keys [id-fn] :or {id-fn :id}})

Takes a vector of maps 'v'. Returns the position of the first item in 'v' whose id-fn (default :id) matches 'id'. Returns nil if id not found

Takes a vector of maps 'v'. Returns the position of the first item in 'v' whose id-fn (default :id) matches 'id'.
Returns nil if id not found
raw docstring

pxcljs

(px val & negative)

takes a number (and optional :negative keyword to indicate a negative value) and returns that number as a string with 'px' at the end

takes a number (and optional :negative keyword to indicate a negative value) and returns that number as a string with 'px' at the end
raw docstring

px-ncljs

(px-n & vals)

takes n numbers (could also be strings) and converts them to a space separated px string e.g. (px-n 10 2 30 4) => '10px 2px 30px 4px' for use in :padding, :margin etc. Most useful when the args are calculations e.g. (px-n top-margin (inc h-width) (- top-margin 5) (dec h-width)) Note: Doesn't support :negative like px above but it will work with negative numbers

takes n numbers (could also be strings) and converts them to a space separated px string
e.g. (px-n 10 2 30 4) => '10px 2px 30px 4px' for use in :padding, :margin etc.
Most useful when the args are calculations
e.g. (px-n top-margin (inc h-width) (- top-margin 5) (dec h-width))
Note: Doesn't support :negative like px above but it will work with negative numbers
raw docstring

remove-id-itemcljs

(remove-id-item id v & {:keys [id-fn] :or {id-fn :id}})

Takes a vector of maps 'v', each of which has an id-fn (default :id) key. Return v where item matching 'id' is excluded

Takes a vector of maps 'v', each of which has an id-fn (default :id) key.
Return v where item matching 'id' is excluded
raw docstring

remove-nthcljs

(remove-nth v n)

Removes the item at position n from a vector v, returning a shrunk vector

Removes the item at position n from a vector v, returning a shrunk vector
raw docstring

sum-scroll-offsetscljs

(sum-scroll-offsets node)

Given a DOM node, I traverse through all ascendant nodes (until I reach body), summing any scrollLeft and scrollTop values and return these sums in a map

Given a DOM node, I traverse through all ascendant nodes (until I reach body), summing any scrollLeft and scrollTop values
and return these sums in a map
raw docstring

table->tsvcljs

(table->tsv columns rows)

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

× close