Library

lorem

Fake data for tests, seed data and mock-ups: filler text, names, emails, addresses, dates, files, ids and sample images, for Scala 3 on the JVM and Scala.js.

4.0.0 on Maven Central

Install

Scala 3.9 or later. On the JVM:

// Mill
mvn"dev.taihei::taihei-lorem:4.0.0"

// sbt
libraryDependencies += "dev.taihei" %% "taihei-lorem" % "4.0.0"

On Scala.js, the same artifact with :: in Mill and %%% in sbt. lorem brings taihei-i18n along for its Language.

Quick start

One object, LoremIpsum. Every call returns a fresh random value:

import dev.taihei.lorem.LoremIpsum

LoremIpsum.name        // Olivia Hernandez
LoremIpsum.email       // olivia.hernandez@brightwavehub.com
LoremIpsum.paragraph   // a paragraph of lorem filler
LoremIpsum.address     // lorem ipsum dolor 42, 1234 Berlin
LoremIpsum.localDate   // a random java.time.LocalDate
LoremIpsum.id          // a UUID-shaped identifier

The values come from java.security.SecureRandom and cannot be seeded, so a test asserts on their shape, such as an email containing @, never on an exact value.

What it makes

  • Text: words, sentences, paragraphs, HTML paragraphs, titles, slugs, passwords.
  • People and the internet: first and last names, emails, URLs, phone numbers.
  • Places: streets, cities, zip codes, addresses, countries, in their own scripts.
  • Dates: today, yesterday, tomorrow, a date in the past or the future.
  • Files and ids: file extensions, MIME types, ids, and two sample images as base64 PNG.

Coming from edo-lorem or genius-lorem

4.0.0 has the API of com.edoframework::edo-lorem:3.0.0 and fish.genius::genius-lorem:2.0.0 under its new name:

  • the dependency is dev.taihei::taihei-lorem;
  • the package is dev.taihei.lorem, so replace com.edoframework.lorem or genius.lorem in your imports;
  • LoremIpsum.language returns the Language of taihei-i18n 4.0.0;
  • coming from genius, it needs Scala 3.9 and brings zio-json 1.1;
  • the licence is Apache 2.0. Releases up to 2.0.0 stay MIT.

Source, issues and release notes on GitHub