Liking cljdoc? Tell your friends :D

Lilac: some validation functions in ClojureScript

Usage

Clojars Project

(require '[lilac.core :refer [validate-lilac number+ string+ or+]])

(validate-lilac 1 (number+))

(validate-lilac 1
  (or+ (number+) (string+)))

Lilac was initially designed to validate recursive data, with a "component" concept begined deflilac:

(require '[lilac.core :refer [deflilac map+ string+]])

(deflilac lilac-tree+ []
  (map+ {:name (string+)
         :children (vector+ (lilac-tree+))}))

To added custom behaviors, do dirty work to:

(swap! lilac.core/*custom-methods assoc :x (fn [x...] (x...)))

If data does not pass validation, you may find by :ok? false and got message:

(validate-lilac data lilac-demo+) ; {:ok? false, :formatted-message "..."}

Contribute to project

If you like the idea in Lilac, fork the project and develop on your own intention. This project does not accept large changes.

The project is developed based on Cirru toolchains. Clojure code are compiled from calcit.cirru. Make sure you are using Calcit Editor if you need the fix to be merged.

Naming

Since Lilac has APIs similar to number or and vector, which are core functions/variables in Clojure. I have to add prefix/suffix in names.

Lilac uses suffix of + in APIs, why? Look at this picture:

lilac picture

License

MIT

Can you improve this documentation? These fine people already did:
jiyinyiyong, ChenYong & Jon
Edit on GitHub

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

× close