Liking cljdoc? Tell your friends :D

nnichols.util

A bunch of utility functions

A bunch of utility functions
raw docstring

->kebab-keysclj/s

Takes a map and returns the map with kebab-cased keys.

Takes a map and returns the map with kebab-cased keys.
sourceraw docstring

->snake-keysclj/s

Takes a map and returns the map with snake_cased keys.

Takes a map and returns the map with snake_cased keys.
sourceraw docstring

->yes-noclj/s

(->yes-no value)

If a value is truthy, returns the string "Yes". Else, return the string "No"

If a value is truthy, returns the string "Yes".
Else, return the string "No"
sourceraw docstring

dissoc-inclj/s

(dissoc-in m [k & ks])

Dissoc the value in m at ks

Dissoc the value in `m` at `ks`
sourceraw docstring

filter-by-keysclj/s

(filter-by-keys f m)

Return m with only the key:value pairs whose keys cause f to evaluate truthily

Return `m` with only the key:value pairs whose keys cause `f` to evaluate truthily
sourceraw docstring

filter-by-valuesclj/s

(filter-by-values f m)

Return m with only the key:value pairs whose values cause f to evaluate truthily

Return `m` with only the key:value pairs whose values cause `f` to evaluate truthily
sourceraw docstring

guidclj/s

Split operator to generate v1 guids based on runtime env

Split operator to generate v1 guids based on runtime env
sourceraw docstring

pluralizeclj/s

(pluralize given-string amount)
(pluralize given-string amount override-string)

Naively pluralize given-string based on amount Optionally, an override-string can be passed for special cases: e.g "peach" -> "peaches"

Naively pluralize `given-string` based on `amount`
Optionally, an `override-string` can be passed for special cases:
e.g "peach" -> "peaches"
sourceraw docstring

rand-keyclj/s

(rand-key m)

Safely return a random key of a map, giving nil for empty maps

Safely return a random key of a map, giving nil for empty maps
sourceraw docstring

rand-kvclj/s

(rand-kv m)

Return a random key-val pair of a map as a map. OPINIONATED: Empty collections return empty maps.

Return a random key-val pair of a map as a map.
OPINIONATED: Empty collections return empty maps.
sourceraw docstring

rand-valclj/s

(rand-val m)

Safely return a random val of a map, giving nil for empty maps

Safely return a random val of a map, giving nil for empty maps
sourceraw docstring

remove-by-keysclj/s

(remove-by-keys f m)

Return m with only the key:value pairs whose keys cause f to evaluate falsily

Return `m` with only the key:value pairs whose keys cause `f` to evaluate falsily
sourceraw docstring

remove-by-valuesclj/s

(remove-by-values f m)

Return m with only the key:value pairs whose values cause f to evaluate falsily

Return `m` with only the key:value pairs whose values cause `f` to evaluate falsily
sourceraw docstring

sort-keysclj/s

Return the sorted keys of a map

Return the sorted keys of a map
sourceraw docstring

sort-valsclj/s

Return the sorted vals of a map

Return the sorted vals of a map
sourceraw docstring

try-or-nilclj/s

(try-or-nil f & args)

Try applying f to args, returning nil in case of an Exception.

Try applying f to args, returning nil in case of an Exception.
sourceraw docstring

update-keysclj/s

(update-keys m f & args)

Return m with f applied to each key in m with its args

Return `m` with `f` applied to each key in `m` with its `args`
sourceraw docstring

update-or-assocclj/s

(update-or-assoc m k v update-fn)

If k exists in m apply the update-fn. Else, assoc v to that k in m

If `k` exists in `m` apply the `update-fn`.
Else, assoc `v` to that `k` in `m`
sourceraw docstring

update-valsclj/s

(update-vals m f & args)

Return m with f applied to each val in m with its args

Return `m` with `f` applied to each val in `m` with its `args`
sourceraw docstring

uuidclj/s

(uuid)

Split operator to generate v1 uuids based on runtime env

Split operator to generate v1 uuids based on runtime env
sourceraw docstring

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

× close