Nf.App (neo_faker v0.6.1)

View Source

Provides functions for generating app metadata.

This module includes functions to generate random app-related information, such as author names, app names, descriptions, versions, and licenses.

Summary

Types

Random result in the form of a string or a list of strings

Functions

Returns a random app author.

Returns a short app description.

Returns a random open-source license.

Returns a random app name.

Returns a semantic version number.

Returns a simple version number.

Types

result()

(since 0.4.0)
@type result() :: String.t() | [String.t()]

Random result in the form of a string or a list of strings

Functions

author(amount \\ 1)

(since 0.4.0)
@spec author(integer()) :: result()

Returns a random app author.

The author name is a randomly generated full name.

Examples

iex> Nf.App.author()
"José Valim"

iex> Nf.App.author(2)
["Joe Armstrong", "José Valim"]

description(amount \\ 1)

(since 0.4.0)
@spec description(integer()) :: result()

Returns a short app description.

The description provides a brief summary of the app.

Examples

iex> Nf.App.description()
"Elixir library for generating fake data in tests and development."

iex> Nf.App.description(2)
["Elixir library for generating fake data in tests and development.",
"Task automation tool for improving development workflows."]

license(amount \\ 1)

(since 0.4.0)
@spec license(integer()) :: result()

Returns a random open-source license.

The license is selected from a predefined list based on ChooseALicense.

Examples

iex> Nf.App.license()
"MIT License"

iex> Nf.App.license(2)
["MIT License", "GNU General Public License v2.0"]

name(opts \\ [])

(since 0.4.0)
@spec name(Keyword.t()) :: String.t()

Returns a random app name.

By default, the app name is generated in a standard format. A different naming style can be specified using the :style option.

Options

The accepted options are:

  • :style - Specifies the style of the app name.

The values for :style can be:

  • nil (default) - Uses the standard format, e.g., "Neo Faker".
  • :camel_case - Uses camel case, e.g., "neoFaker".
  • :pascal_case - Uses Pascal case, e.g., "NeoFaker".
  • :dashed - Uses a dashed style, e.g., "Neo-faker".
  • :underscore - Uses an underscore style, e.g., "neo_faker".
  • :single - Uses a single-word format, e.g., "Faker".

Examples

iex> Nf.App.name()
"Neo Faker"

iex> Nf.App.name(style: :camel_case)
"neoFaker"

semver(opts \\ [])

(since 0.4.0)
@spec semver(Keyword.t()) :: String.t()

Returns a semantic version number.

The generated version number follows the Semantic Versioning (SemVer) standard. By default, it generates a core version (MAJOR.MINOR.PATCH). Additional versioning details can be specified using the :type option.

Options

The accepted options are:

  • :type - Specifies the type of version format.

The values for :type can be:

  • nil (default) - Uses core SemVer format, e.g., "1.2.3".
  • :pre_release - Includes a pre-release label, e.g., "1.2.3-beta.1".
  • :build - Includes a build metadata label, e.g., "1.2.3+20250325".
  • :pre_release_build - Includes both pre-release and build metadata, e.g., "1.2.3-rc.1+20250325".

Examples

iex> Nf.App.semver()
"1.2.3"

iex> Nf.App.semver(:pre_release)
"1.2.3-beta.1"

version()

(since 0.4.0)
@spec version() :: String.t()

Returns a simple version number.

This version format follows MAJOR.MINOR.

Examples

iex> Nf.App.version()
"1.2"