This library provides a number of convenience helpers for use with Reagent.
(get-raw k & [default])
gets the value at the key (as string), optional default when value is not found
(remove! k)
(remove! k path domain)
removes a cookie, optionally for a specific path and/or domain
(set! k content & [{:keys [max-age path domain secure? raw?]} :as opts])
sets a cookie, the max-age for session cookie following optional parameters may be passed in as a map: :max-age - defaults to -1 :path - path of the cookie, defaults to the full request path :domain - domain of the cookie, when null the browser will use the full request host name :secure? - boolean specifying whether the cookie should only be sent over a secure channel :raw? - boolean specifying whether content should be stored raw, or as EDN
(currency-format n)
formats currency using the current locale to change locale set goog.i18n.NumberFormatSymbols eg: (set! goog.i18n.NumberFormatSymbols goog.i18n.NumberFormatSymbols_it_IT) see here for supported locales https://github.com/google/closure-library/blob/master/closure/goog/i18n/compactnumberformatsymbols.js
(format fmt & args)
Formats a string using goog.string.format. e.g: (format "Cost: %.2f" 10.0234)
(pluralize items & [word ending1 ending2 :as opts])
pluralizes the word based on the number of items (util/pluralize ["John"] "lad") (util/pluralize ["John" "James"] "lad") (util/pluralize ["Alice"] "lad" "y" "ies")
(assoc-in! ks v)
Associates a value in the session, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created.
(get! k & [default])
Destructive get from the session. This returns the current value of the key and then removes it from the session.
(get-in ks & [default])
Gets the value at the path specified by the vector ks from the session, returns nil if it doesn't exist.
(get-in! ks & [default])
Destructive get from the session. This returns the current value of the path specified by the vector ks and then removes it from the session.
(swap! f & args)
Replace the current session's value with the result of executing f with the current value and args.
(update! k f & args)
Updates a value in session where k is a key and f is the function that takes the old value along with any supplied args and return the new value. If key is not present it will be added.
Functions for validating input and setting string errors on fields.
(has-values? coll)
Returns true if all members of the collection has-value? This works on maps as well.
(matches-regex? v regex)
Returns true if the string matches the given regular expression