Exflect (exflect v0.2.0)

Summary

Functions

Inflects the input word based on the the integer given.

Pluralizes an English word.

Functions

Link to this function

inflect(word, n, opts \\ [match_style: false])

@spec inflect(String.t(), pos_integer(), keyword()) :: String.t()

Inflects the input word based on the the integer given.

$ Exflect.inflect("leaf", 0)
=> "leaves"
$ Exflect.inflect("leaf", 1)
=> "leaf"
$ Exflect.inflect("leaf", 2)
=> "leaves"

Also accepts the match_style option

Link to this function

pluralize(word, opts \\ [match_style: false])

@spec pluralize(
  String.t(),
  keyword()
) :: String.t()

Pluralizes an English word.

$ Exflect.pluralize("leaf")
=> "leaves"

Takes the option match_style if you want it to maintain the current whitespace/case.

$ Exflect.pluralize("  LEAF  ", match_style: true)
=> "  LEAVES  "
Link to this function

singularize(text, opts \\ [match_style: false])

@spec singularize(
  String.t(),
  keyword()
) :: String.t()

Singlarizes an English word.

$ Exflect.singularize("leaves")
=> "leaf"

Takes the option match_style if you want it to maintain the current whitespace/case.

$ Exflect.singularize("  LEAVES  ", match_style: true)
=> "  LEAF  "