Liking cljdoc? Tell your friends :D

inflections.core


*acronyms*clj/s

source

*irregular-words*clj/s

source

*plural-rules*clj/s

source

*singular-rules*clj/s

source

*uncountable-words*clj/s

source

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.
sourceraw docstring

add-acronym!clj/s

(add-acronym! word)

Adds word to the set of *acronyms*.

Adds `word` to the set of `*acronyms*`.
sourceraw 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*`.
sourceraw docstring

add-rule!clj/s

(add-rule! rules rule)
source

add-uncountable!clj/s

(add-uncountable! word)

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

Adds `word` to the set of `*uncountable-words*`.
sourceraw 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"
sourceraw 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.
sourceraw 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"
sourceraw docstring

coerceclj/s

(coerce obj s)

Coerce the string s to the type of obj.

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

countable?clj/s

(countable? s)

Returns true if s is countable, otherwise false.

Returns true if `s` is countable, otherwise false.
sourceraw 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"
sourceraw docstring

delete-acronym!clj/s

(delete-acronym! word)

Delete word from the set of *acronyms*.

Delete `word` from the set of `*acronyms*`.
sourceraw 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*.
sourceraw docstring

delete-uncountable!clj/s

(delete-uncountable! word)

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

Delete `word` from the set of `*uncountable-words*`.
sourceraw 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"
sourceraw 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"
sourceraw 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"
sourceraw docstring

hyphenate-keysclj/s

(hyphenate-keys m)

Recursively apply hyphenate on all keys of m.

Recursively apply hyphenate on all keys of m.
sourceraw docstring

hyphenate-valuesclj/s

(hyphenate-values m)

Recursively apply hyphenate on all values of m.

Recursively apply hyphenate on all values of m.
sourceraw docstring

init-inflections!clj/s

(init-inflections!)

Initialize the Inflections library with defaults.

Initialize the Inflections library with defaults.
sourceraw docstring

init-irregular-words!clj/s

(init-irregular-words!)
source

init-plural-rules!clj/s

(init-plural-rules!)
source

init-singular-rules!clj/s

(init-singular-rules!)
source

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.
sourceraw 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"
sourceraw 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"
sourceraw docstring

pluralclj/s

(plural s)

Returns the plural of s.

Returns the plural of s.
sourceraw 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")
sourceraw 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.
sourceraw docstring

reset-rules!clj/s

(reset-rules! rules)

Resets the list of plural rules.

Resets the list of plural rules.
sourceraw docstring

resolve-ruleclj/s

(resolve-rule rule word)
source

resolve-rulesclj/s

(resolve-rules rules word)
source

Rulecljs

source

singularclj/s

(singular s)

Returns the singular of s.

Returns the singular of s.
sourceraw 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")
sourceraw 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.
sourceraw 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.
sourceraw docstring

stringify-keysclj/s

(stringify-keys m)

Recursively transform all keys of m into strings.

Recursively transform all keys of m into strings.
sourceraw docstring

stringify-valuesclj/s

(stringify-values m)

Recursively transform all values of m into strings.

Recursively transform all values of m into strings.
sourceraw docstring

titleizeclj/s

(titleize s)

Convert s into a title.

Convert `s` into a title.
sourceraw 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.
sourceraw 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.
sourceraw docstring

uncountable?clj/s

(uncountable? x)

Returns true if x is uncountable, otherwise false.

Returns true if `x` is uncountable, otherwise false.
sourceraw 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"
sourceraw docstring

underscore-keysclj/s

(underscore-keys m)

Recursively apply underscore on all keys of m.

Recursively apply underscore on all keys of m.
sourceraw docstring

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

× close