Liking cljdoc? Tell your friends :D

lambdaisland.faker

Create fake values that look "nice", i.e. real-world-ish, so it's quick and easy to populate UIs to get a feel for how they behave.

The single fake function is the main interface, it can do a bunch of things. You can pass it a "path" of something it knows about,

  • (fake [:address :city])
  • (fake [:vehicle :vin])

A partial path will return a map of all nested fakers,

  • (fake [:address]) ;;=> {:country "..", :street_address "...", ....}

A regex will generate values that match the regex

  • (fake #"[A-Z0-9]{3}")

A string is treated as a pattern, use #{} to nest faker paths, using dotted notation, or "#" to put a digit.

  • (fake "#{company.name} GmbH")
  • (fake "##-####-##")

Use a set to pick one of multiple choices

  • (fake #{[:name :first-name] [:name :last-name]})

A map will generate values for each map value. Fakers that are invoked multiple times are memoized. Since a lot of fakers are based on other fakers, this allows you to generate related values.

See the comment at the bottom of the namespace for examples.

Create fake values that look "nice", i.e. real-world-ish, so it's quick and
easy to populate UIs to get a feel for how they behave.

The single [[fake]] function is the main interface, it can do a bunch of
things. You can pass it a "path" of something it knows about,

- (fake [:address :city])
- (fake [:vehicle :vin])

A partial path will return a map of all nested fakers,

- (fake [:address]) ;;=> {:country "..", :street_address "...", ....}

A regex will generate values that match the regex

- (fake #"[A-Z0-9]{3}")

A string is treated as a pattern, use #{} to nest faker paths, using dotted
notation, or "#" to put a digit.

- (fake "#{company.name} GmbH")
- (fake "##-####-##")

Use a set to pick one of multiple choices

- (fake #{[:name :first-name] [:name :last-name]})

A map will generate values for each map value. Fakers that are invoked
multiple times are memoized. Since a lot of fakers are based on other fakers,
this allows you to generate related values.

- (fake {:name [:name :name] :email [:internet :email]})
  ;; => {:name "Freiherrin Marlena Daimer", :email "marlenadaimer@daimerohg.com"}

See the comment at the bottom of the namespace for examples.
raw docstring

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

× close