Liking cljdoc? Tell your friends :D

rapid-fake

A Clojure fake data generator library inspired by Ruby's Faker.

Installation

Add to your deps.edn:

{:deps {io.github.bolivier/rapid-fake {:git/tag "v0.1.0" :git/sha "..."}}}

Usage

Everything goes through a single function: fake.

(require '[rapid-fake.core :refer [fake]])

;; Simple usage - pass a [category generator] vector
(fake [:name :first-name])        ;=> "Jessica"
(fake [:name :name])              ;=> "Robert Garcia"
(fake [:internet :email])         ;=> "john.smith@gmail.com"
(fake [:address :city])           ;=> "North Jessica"
(fake [:lorem :sentence])         ;=> "Veritatis eos magni dolorem amet."

;; With options
(fake [:internet :password] {:min-length 12 :max-length 20})
(fake [:lorem :words] {:word-count 5})
(fake [:number :between] {:min 1 :max 100})
(fake [:date :birthday] {:min-age 21 :max-age 30})
(fake [:commerce :price] {:min 10.0 :max 50.0})

Categories

CategoryGenerators
:name:name :first-name :last-name :male-first-name :female-first-name :prefix :suffix :name-with-middle :initials
:address:full-address :street-address :street-name :city :state :state-abbr :zip-code :country :country-code :building-number :latitude :longitude
:internet:email :username :password :domain-name :domain-suffix :url :ip-v4-address :ip-v6-address :mac-address :user-agent :slug :uuid :base64
:phone-number:phone-number :cell-phone :country-code :area-code :subscriber-number
:company:name :suffix :industry :catch-phrase :buzzword :bs :type :profession :department
:lorem:word :words :sentence :sentences :paragraph :paragraphs :characters :question :questions
:commerce:department :product-name :material :price :promotion-code :brand
:number:number :decimal :between :positive :negative :digit :hexadecimal
:date:between :birthday :forward :backward
:color:hex-color :color-name :rgb-color :hsl-color
:finance:credit-card :vat-number
:bank:name :routing-number :account-number
:job:title :field :seniority :position :key-skill
:currency:name :code :symbol
:id-number:valid :ssn-valid
:code:isbn :ean :npi :imei :asin
:file:extension :mime-type :file-name
:vehicle:make :model :make-and-model :vin :license-plate :color
:food:dish :description :ingredient :fruit :vegetable :spice
:beer:name :style :hop :yeast :malt :brand
:coffee:blend-name :origin :variety :notes :intensifier
:tea:variety :type
:dessert:variety :topping :flavor
:book:title :author :publisher :genre
:educator:university :degree :course-name :campus
:science:element :element-symbol :element-state :scientist
:space:planet :moon :galaxy :nebula :star :constellation :agency :launch-vehicle :meteorite
:computer:type :platform :os :stack
:device:model-name :platform :manufacturer :serial
:app:name :version :author
:subscription:plan :status :payment-method :payment-term
:blood:type :rh-factor :group
:gender:type :binary-type :short-binary-type
:demographic:race :educational-attainment :marital-status :sex :demonym
:relationship:familial :in-law :spouse :parent :sibling
:measurement:height :length :volume :weight :metric-height :metric-length :metric-volume :metric-weight
:construction:heavy-equipment :trade :subcontract-category :standard-cost-code :material
:house:furniture :room
:restaurant:name :type :description
:animal:name
:cat:name :breed :registry
:dog:name :breed :sound :meme-phrase
:horse:name :breed
:bird:name :family :order
:emotion:noun :adjective
:hobby:activity
:sport:sport :summer-olympics :winter-olympics
:nation:nationality :language :capital-city :flag
:military:army-rank :marine-rank :navy-rank :air-force-rank :coast-guard-rank :space-force-rank :dod-paygrade
:hacker:abbreviation :adjective :noun :verb :ingverb :say-something-smart
:hipster:word :words :sentence :sentences :paragraph :paragraphs
:superhero:name :prefix :suffix :descriptor :power
:ancient:god :primordial :titan :hero
:programming-language:name :creator

Development

# Run tests
clj -X:test

# Build JAR
clj -T:build jar

# Clean build artifacts
clj -T:build clean

License

MIT

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close