Liking cljdoc? Tell your friends :D

clojure.contrib.humanize


datetimeclj/s

(datetime then-dt
          &
          {:keys [now-dt suffix] :or {now-dt (local-now) suffix "ago"}})

Given a datetime or date, return a human-friendly representation of the amount of time elapsed.

Given a datetime or date, return a human-friendly representation
of the amount of time elapsed. 
sourceraw docstring

durationclj/s

(duration duration-ms)
(duration duration-ms options)

Converts duration, in milliseconds, into a string describing it in terms of years, months, weeks, days, hours, minutes, and seconds.

Ex:

(duration 325100) => "five minutes, twenty-five seconds"

The months and years periods are not based on actual calendar, so are approximate; this function works best for shorter periods of time.

The optional options map allow some control over the result.

:list-format (default: a function) can be set to a function such as oxford

:number-format (default: numberword) function used to format period counts

:short-text (default: "less than a second")

Converts duration, in milliseconds, into a string describing it in terms
of years, months, weeks, days, hours, minutes, and seconds.

Ex:

   (duration 325100) => "five minutes, twenty-five seconds"

The months and years periods are not based on actual calendar, so are approximate; this
function works best for shorter periods of time.

The optional options map allow some control over the result.

:list-format (default: a function) can be set to a function such as oxford

:number-format (default: numberword) function used to format period counts

:short-text (default: "less than a second") 
sourceraw docstring

filesizeclj/s

(filesize bytes & {:keys [binary format] :or {binary false format "%.1f"}})

Format a number of bytes as a human readable filesize (eg. 10 kB). By default, decimal suffixes (kB, MB) are used. Passing :binary true will use binary suffixes (KiB, MiB) instead.

Format a number of bytes as a human readable filesize (eg. 10 kB). By
default, decimal suffixes (kB, MB) are used.  Passing :binary true will use
binary suffixes (KiB, MiB) instead.
sourceraw docstring

intcommaclj/s

(intcomma num)

Converts an integer to a string containing commas. every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'.

Converts an integer to a string containing commas. every three digits.
For example, 3000 becomes '3,000' and 45000 becomes '45,000'. 
sourceraw docstring

intwordclj/s

(intword num & {:keys [format] :or {format "%.1f"}})

Converts a large integer to a friendly text representation. Works best for numbers over 1 million. For example, 1000000 becomes '1.0 million', 1200000 becomes '1.2 million' and '1200000000' becomes '1.2 billion'. Supports up to decillion (33 digits) and googol (100 digits).

Converts a large integer to a friendly text representation. Works best for
numbers over 1 million. For example, 1000000 becomes '1.0 million', 1200000
becomes '1.2 million' and '1200000000' becomes '1.2 billion'.  Supports up to
decillion (33 digits) and googol (100 digits).
sourceraw docstring

lognclj/s

(logn num base)
source

numberwordclj/s

(numberword num)

Takes a number and return a full written string form. For example, 23237897 will be written as "twenty-three million two hundred and thirty-seven thousand eight hundred and ninety-seven".

Takes a number and return a full written string form. For example,
23237897 will be written as "twenty-three million two hundred and
thirty-seven thousand eight hundred and ninety-seven".  
sourceraw docstring

ordinalclj/s

(ordinal num)

Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc.

Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd',
3 is '3rd', etc.
sourceraw docstring

oxfordclj/s

(oxford coll
        &
        {:keys [maximum-display truncate-noun]
         :or {maximum-display 4 truncate-noun nil}})

Converts a list of items to a human readable string with an optional limit.

Converts a list of items to a human readable string
with an optional limit.
sourceraw docstring

truncateclj/s

(truncate string length)
(truncate string length suffix)

Truncate a string with suffix (ellipsis by default) if it is longer than specified length.

Truncate a string with suffix (ellipsis by default) if it is
longer than specified length.
sourceraw docstring

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

× close