Liking cljdoc? Tell your friends :D

rads.inflections

A fork of inflections-clj with compatibility for Cherry.

A fork of inflections-clj with compatibility for Cherry.
raw docstring

*acronyms*clj/s


*irregular-words*clj/s


*plural-rules*clj/s


*singular-rules*clj/s


*uncountable-words*clj/s


->ruleclj/s

(->rule pattern replacement)

acronymclj/s

(acronym s)

Returns the the acronym for s if it is one, otherwise nil.

Returns the the acronym for `s` if it is one, otherwise nil.
raw docstring

add-acronym!clj/s

(add-acronym! word)

Adds word to the set of *acronyms*.

Adds `word` to the set of `*acronyms*`.
raw docstring

add-irregular!clj/s

(add-irregular! singular plural)

Add singular and plural to the set of *irregular-words*.

Add `singular` and `plural` to the set of `*irregular-words*`.
raw docstring

add-rule!clj/s

(add-rule! rules rule)

add-uncountable!clj/s

(add-uncountable! word)

Adds word to the set of *uncountable-words*.

Adds `word` to the set of `*uncountable-words*`.
raw docstring

camel-caseclj/s

(camel-case word & [mode])

Convert word to camel case. By default, camel-case converts to UpperCamelCase. If the argument to camel-case is set to :lower then camel-case produces lowerCamelCase.

Examples:

(camel-case "active_record") ;=> "ActiveRecord"

(camel-case "active_record" :lower) ;=> "activeRecord"

(camel-case "active_record/errors") ;=> "ActiveRecord/Errors"

(camel-case "active_record/errors" :lower) ;=> "activeRecord/Errors"

Convert `word` to camel case. By default, camel-case converts to
UpperCamelCase. If the argument to camel-case is set to :lower then
camel-case produces lowerCamelCase.

Examples:

  (camel-case "active_record")
  ;=> "ActiveRecord"

  (camel-case "active_record" :lower)
  ;=> "activeRecord"

  (camel-case "active_record/errors")
  ;=> "ActiveRecord/Errors"

  (camel-case "active_record/errors" :lower)
  ;=> "activeRecord/Errors"
raw docstring

camel-case-keysclj/s

(camel-case-keys m & [mode])

Recursively apply camel-case on all keys of m.

Recursively apply camel-case on all keys of m.
raw docstring

capitalizeclj/s

(capitalize word)

Convert the first letter in word to upper case.

Examples:

(capitalize "hello") ;=> "Hello"

(capitalize "HELLO") ;=> "Hello"

(capitalize "abc123") ;=> "Abc123"

Convert the first letter in `word` to upper case.

Examples:

  (capitalize "hello")
  ;=> "Hello"

  (capitalize "HELLO")
  ;=> "Hello"

  (capitalize "abc123")
  ;=> "Abc123"
raw docstring

coerceclj/s

(coerce obj s)

Coerce the string s to the type of obj.

Coerce the string `s` to the type of `obj`.
raw docstring

countable?clj/s

(countable? s)

Returns true if s is countable, otherwise false.

Returns true if `s` is countable, otherwise false.
raw docstring

dasherizeclj/s

(dasherize s)

Replaces all underscores in s with dashes.

Examples:

(dasherize "puni_puni") ;=> "puni-puni"

Replaces all underscores in `s` with dashes.

Examples:

  (dasherize "puni_puni")
  ;=> "puni-puni"
raw docstring

delete-acronym!clj/s

(delete-acronym! word)

Delete word from the set of *acronyms*.

Delete `word` from the set of `*acronyms*`.
raw docstring

delete-irregular!clj/s

(delete-irregular! singular plural)

Delete singular and plural from the set of irregular-words.

Delete `singular` and `plural` from the set of *irregular-words*.
raw docstring

delete-uncountable!clj/s

(delete-uncountable! word)

Delete word from the set of *uncountable-words*.

Delete `word` from the set of `*uncountable-words*`.
raw docstring

demodulizeclj/s

(demodulize x)

Removes the module part from x.

Examples:

(demodulize "inflections.MyRecord") ;=> "MyRecord"

(demodulize "ActiveRecord::CoreExtensions::String::Inflections") ;=> "Inflections"

(demodulize "Inflections") ;=> "Inflections"

Removes the module part from `x`.

Examples:

  (demodulize "inflections.MyRecord")
  ;=> "MyRecord"

  (demodulize "ActiveRecord::CoreExtensions::String::Inflections")
  ;=> "Inflections"

  (demodulize "Inflections")
  ;=> "Inflections"
raw docstring

foreign-keyclj/s

(foreign-key x & [sep])

Converts x into a foreign key. The default separator "_" is placed between the name and "id".

Examples:

(foreign-key "Message") ;=> "message_id"

(foreign-key "Message" false) ;=> "messageid"

(foreign-key "Admin::Post") ;=> "post_id"

Converts `x` into a foreign key. The default separator "_" is
placed between the name and "id".


Examples:

  (foreign-key "Message")
  ;=> "message_id"

  (foreign-key "Message" false)
  ;=> "messageid"

  (foreign-key "Admin::Post")
  ;=> "post_id"
raw docstring

hyphenateclj/s

(hyphenate x)

Hyphenate x, which is the same as threading x through the str, underscore and dasherize fns.

Examples:

(hyphenate 'Continent) ; => "continent"

(hyphenate "CountryFlag") ; => "country-flag"

Hyphenate x, which is the same as threading `x` through the str,
underscore and dasherize fns.

Examples:

  (hyphenate 'Continent)
  ; => "continent"

  (hyphenate "CountryFlag")
  ; => "country-flag"
raw docstring

hyphenate-keysclj/s

(hyphenate-keys m)

Recursively apply hyphenate on all keys of m.

Recursively apply hyphenate on all keys of m.
raw docstring

hyphenate-valuesclj/s

(hyphenate-values m)

Recursively apply hyphenate on all values of m.

Recursively apply hyphenate on all values of m.
raw docstring

init-inflections!clj/s

(init-inflections!)

Initialize the Inflections library with defaults.

Initialize the Inflections library with defaults.
raw docstring

init-irregular-words!clj/s

(init-irregular-words!)

init-plural-rules!clj/s

(init-plural-rules!)

init-singular-rules!clj/s

(init-singular-rules!)

irregular?clj/s

(irregular? word)

Returns true if word is an irregular word, otherwise false.

Returns true if `word` is an irregular word, otherwise false.
raw docstring

ordinalizeclj/s

(ordinalize x)

Turns x into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th, etc.

Examples:

(ordinalize "1") ;=> "1st"

(ordinalize "23") ;=> "23rd"

Turns `x` into an ordinal string used to denote the position in an
ordered sequence such as 1st, 2nd, 3rd, 4th, etc.

Examples:

  (ordinalize "1")
  ;=> "1st"

  (ordinalize "23")
  ;=> "23rd"
raw docstring

parameterizeclj/s

(parameterize x & [sep])

Replaces special characters in x with the default separator "-". so that it may be used as part of a pretty URL.

Examples:

(parameterize "Donald E. Knuth") ; => "donald-e-knuth"

(parameterize "Donald E. Knuth" "_") ; => "donald_e_knuth"

Replaces special characters in `x` with the default separator
"-". so that it may be used as part of a pretty URL.

Examples:

  (parameterize "Donald E. Knuth")
  ; => "donald-e-knuth"

  (parameterize "Donald E. Knuth" "_")
  ; => "donald_e_knuth"
raw docstring

pluralclj/s

(plural s)

Returns the plural of s.

Returns the plural of s.
raw docstring

plural!clj/s

(plural! & patterns-and-replacements)

Define rule(s) to map words from singular to plural.

Examples: (plural! #"$(?i)" "s") (plural! #"(ax|test)is$(?i)" "$1es" #"(octop|vir)us$(?i)" "$1i")

Define rule(s) to map words from singular to plural.

Examples: (plural! #"$(?i)" "s")
          (plural! #"(ax|test)is$(?i)" "$1es"
                   #"(octop|vir)us$(?i)" "$1i")
raw docstring

pluralizeclj/s

(pluralize count singular & [plural])

Attempts to pluralize the word unless count is 1. If plural is supplied, it will use that when count is > 1, otherwise it will use the inflector to determine the plural form.

Attempts to pluralize the word unless count is 1. If plural is
supplied, it will use that when count is > 1, otherwise it will use
the inflector to determine the plural form.
raw docstring

reset-rules!clj/s

(reset-rules! rules)

Resets the list of plural rules.

Resets the list of plural rules.
raw docstring

resolve-ruleclj/s

(resolve-rule rule word)

resolve-rulesclj/s

(resolve-rules rules word)

singularclj/s

(singular s)

Returns the singular of s.

Returns the singular of s.
raw docstring

singular!clj/s

(singular! & patterns-and-replacements)

Define rule(s) to map words from singular to plural.

Examples: (singular! #"(n)ews$(?i)" "$1ews") (singular! #"(m)ovies$(?i)" "$1ovie" #"([m|l])ice$(?i)" "$1ouse")

Define rule(s) to map words from singular to plural.

Examples: (singular! #"(n)ews$(?i)" "$1ews")
          (singular! #"(m)ovies$(?i)" "$1ovie"
                     #"([m|l])ice$(?i)" "$1ouse")
raw docstring

slurp-rulesclj/s

(slurp-rules & patterns-and-replacements)

Returns a seq of rules, where the pattern and replacement must be given in pairs of two elements.

Returns a seq of rules, where the pattern and replacement must be
given in pairs of two elements.
raw docstring

str-nameclj/s

(str-name x)

Same as clojure.core/name, but keeps the namespace for keywords and symbols.

Same as `clojure.core/name`, but keeps the namespace for keywords
and symbols.
raw docstring

stringify-keysclj/s

(stringify-keys m)

Recursively transform all keys of m into strings.

Recursively transform all keys of m into strings.
raw docstring

stringify-valuesclj/s

(stringify-values m)

Recursively transform all values of m into strings.

Recursively transform all values of m into strings.
raw docstring

titleizeclj/s

(titleize s)

Convert s into a title.

Convert `s` into a title.
raw docstring

transform-keysclj/s

(transform-keys m f)

Recursively transform all keys in the map m by applying f on them.

Recursively transform all keys in the map `m` by applying `f` on them.
raw docstring

transform-valuesclj/s

(transform-values m f)

Recursively transform all map values of m by applying f on them.

Recursively transform all map values of m by applying f on them.
raw docstring

uncountable?clj/s

(uncountable? x)

Returns true if x is uncountable, otherwise false.

Returns true if `x` is uncountable, otherwise false.
raw docstring

underscoreclj/s

(underscore x)

The reverse of camel-case. Makes an underscored, lowercase form from the expression in the string.

Examples:

(underscore "ActiveRecord") ;=> "active_record"

(underscore "ActiveRecord::Errors") ;=> "active_record::errors"

The reverse of camel-case. Makes an underscored, lowercase form from
the expression in the string.

Examples:

  (underscore "ActiveRecord")
  ;=> "active_record"

  (underscore "ActiveRecord::Errors")
  ;=> "active_record::errors"
raw docstring

underscore-keysclj/s

(underscore-keys m)

Recursively apply underscore on all keys of m.

Recursively apply underscore on all keys of m.
raw docstring

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

× close