std.lib.transform.coerce

*coerce-chart*

dynamic

*handler*

dynamic

assoc-set

added in 3.0

(assoc-set m s v)(assoc-set m s v & more)

associates a set as keys to a map (assoc-set {} #{:a :b :c} 1) => {:a 1, :b 1, :c 1}

coerce

added in 3.0

(coerce v t)(coerce v t chart)

associates a set as keys to a map (coerce 1 :string) => “1”

(coerce “2017-05-25T17:29:46.000Z” :instant) => (java.util.Date. 117 4 25 17 29 46)

(coerce “2017-05-25T17:29:46Z” :instant) => (java.util.Date. 117 4 25 17 29 46)

(coerce “oeuoe” :keyword) => :oeuoe

date-format-js

date-format-json

default-coerce-chart

default-coerce-to-string-chart

from-string-chart

hash-mapset

added in 3.0

(hash-mapset s v)(hash-mapset s v & more)

constructs a hashmap from a set of keys

(hash-mapset #{:a :b :c} 1 #{:d :e} 2) => {:c 1, :b 1, :a 1, :e 2, :d 2}

Numbers

parse-date

added in 3.0

(parse-date s)

converts string to date

(parse-date “2017-05-25T17:29:46.000Z”) ;;#inst “2017-05-25T09:29:46.000-00:00” => java.util.Date

read-enum

added in 3.0

(read-enum s)

helper function for enums

(read-enum “:enum”) => :enum

(read-enum “12334”) => 12334

(read-enum “{}”) => (throws)

read-ref

added in 3.0

(read-ref s)

helper function for refs

(read-ref “{:a 1}”) => {:a 1}

(read-ref “_”) => (throws)

Strings