stillsuit.lib.util

A collection of utility functions.

deep-map-merge

(deep-map-merge & maps)

Recursively merge one or more maps, using the values of later maps to replace the values of earlier ones.

deep-merge-with

(deep-merge-with f & maps)

Like merge-with, but merges maps recursively, appling the given fn only when there’s a non-map at a particular level.

  (deep-merge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4}
                     {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}})
  ; => {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}

load-edn-file

(load-edn-file filename)

Given a filename in resources, read and parse it, returning nil if it wasn’t found

load-edn-resource

(load-edn-resource resource-path)

Given a filename in resources, read and parse it, returning nil if it wasn’t found

simplify

(simplify m)

Converts all ordered maps nested within the map into standard hash maps, and sequences into vectors, which makes for easier constants in the tests, and eliminates ordering problems.