Liking cljdoc? Tell your friends :D

tornado.util

Utility functions used internally in Tornado.

Utility functions used internally in Tornado.
raw docstring

*compress?*clj/s

Moved from this ns to util in version 0.2.10 to prevent cyclic dependency needed in ns-kw->str.

Moved from this ns to util in version 0.2.10 to prevent cyclic dependency needed in `ns-kw->str`.
sourceraw docstring

->fixedclj/s

(->fixed x)
(->fixed x d)

Rounds a given number x to d decimal digits, or 0 by default.

Rounds a given number x to d decimal digits, or 0 by default.
sourceraw docstring

apply-avgclj/s

(apply-avg coll)

Same as (apply average coll)

Same as (apply average coll)
sourceraw docstring

averageclj/s

(average & args)

Computes the average of 1 or more numbers. Accepts elements directly, use apply-avg for a sequence.

Computes the average of 1 or more numbers. Accepts elements directly,
use apply-avg for a sequence.
sourceraw docstring

base10->double-hex-mapclj/s

source

base16-charsclj/s

source

betweenclj/s

(between value n1 n2)

Returns true if value is smaller than or equal n1 and greater than or equal n2.

Returns true if value is smaller than or equal n1 and greater than or equal n2.
sourceraw docstring

char->intclj/s

(char->int x)
source

conjvclj/s

(conjv v value)

Equal to (conj (vec v) value).

Equal to (conj (vec v) value).
sourceraw docstring

double-hex->base10-mapclj/s

A precalculated map for very fast conversions of hexadecimal strings in format "xx" to base10 numbers.

A precalculated map for very fast conversions of hexadecimal strings in format "xx"
to base10 numbers.
sourceraw docstring

double-hex?clj/s

(double-hex? str-expr)

Returns true if every 2-characters substring of the given string expression matches to the hexadecimal characters.

Returns true if every 2-characters substring of the given string expression
matches to the hexadecimal characters.
sourceraw docstring

exceptionclj/s

(exception arg)
source

get-str-formclj/s

(get-str-form x)

If the argument is a symbol, a keyword or a string, returns its string form. Otherwise, returns nil.

If the argument is a symbol, a keyword or a string, returns its string form.
Otherwise, returns nil.
sourceraw docstring

in-rangeclj/s

(in-range val min-val max-val)

If the value is not in range of min-val and max-val, returns the value of the corresponding border which is nearer to the value, otherwise returns the value.

If the value is not in range of min-val and max-val, returns the value of the
corresponding border which is nearer to the value, otherwise returns the value.
sourceraw docstring

int*clj/s

(int* x)

Converts a float to an integer if the value would remain equal. Ratios will be converted to a float, or, again, to an integer if possible.

Converts a float to an integer if the value would remain equal. Ratios will
be converted to a float, or, again, to an integer if possible.
sourceraw docstring

JS-STR-TYPEcljs

source

lowercase-uppercase-differenceclj/s

source

math-absclj/s

(math-abs x)
source

math-powclj/s

(math-pow x y)
source

math-roundclj/s

(math-round x)
source

named?clj/s

(named? x)

Returns true if the argument is a symbol, a keyword or a string.

Returns true if the argument is a symbol, a keyword or a string.
sourceraw docstring

ns-kw->strclj/s

(ns-kw->str expr)
source

parse-floatclj/s

(parse-float s)
source

percent->numberclj/s

(percent->number value)
(percent->number value throw-if-no-match)

If the argument is a value in percent, convert it to a corresponding numeral value. Throws an exception if the optional 2nd argument has a truthy value and the input type is none of string, number or CSSUnit instance. Otherwise thís function does not do anything and will return the input.

(percent->int 0.5) => 0.5

(percent->int "75%") ; can be "75 %" as well => 0.75

(percent->int (tornado.units/percent 35)) => 0.35

If the argument is a value in percent, convert it to a corresponding numeral value.
Throws an exception if the optional 2nd argument has a truthy value and the input
type is none of string, number or CSSUnit instance. Otherwise thís function does not
do anything and will return the input.

(percent->int 0.5)
=> 0.5

(percent->int "75%")   ; can be "75 %" as well
=> 0.75

(percent->int (tornado.units/percent 35))
=> 0.35
sourceraw docstring

percent-with-symbol-appendclj/s

(percent-with-symbol-append value)

Multiplies a number with 100 to get a percentage value of it. Returns a string form of it with "%" appended. Non-numbers are returned unaffected.

Multiplies a number with 100 to get a percentage value of it. Returns
a string form of it with "%" appended. Non-numbers are returned unaffected.
sourceraw docstring

prune-nilsclj/s

(prune-nils m)

Given a map, removes all keys having nil value. If the pruned map is empty, returns nil.

Given a map, removes all keys having nil value. If the pruned map is empty, returns nil.
sourceraw docstring

round-4dclj/s

(round-4d x)

Rounds a given number to 4 decimal digits, which should be enough in most cases. Used for inaccurate calculations, e.g.: (* 1.0 100)

Rounds a given number to 4 decimal digits, which should be enough in most cases.
Used for inaccurate calculations, e.g.: (* 1.0 100)
sourceraw docstring

some-instance?clj/s

(some-instance? expr & classes)

Returns true if the expression is an instance of any from the given classes.

Returns true if the expression is an instance of any from the given classes.
sourceraw docstring

str-butlastclj/s

(str-butlast s)

Returns the given string without the last character.

Returns the given string without the last character.
sourceraw docstring

str-colon-joinclj/s

(str-colon-join coll)

str/join with ": "

str/join with ": "
sourceraw docstring

str-comma-joinclj/s

(str-comma-join coll)

str/join with ", "

str/join with ", "
sourceraw docstring

str-space-joinclj/s

(str-space-join coll)

str/join with " "

str/join with " "
sourceraw docstring

str-typeclj/s

source

to-percent-floatclj/s

(to-percent-float value)

Parses a percentage from a string or multiplies a number with 100 to get a percentage value of it: (tpf "12%") => 12 (tpf "3") => 300 (tpf 8) => 800

Parses a percentage from a string or multiplies a number with 100 to get
a percentage value of it:
(tpf "12%") => 12
(tpf "3") => 300
(tpf 8) => 800
sourceraw docstring

toLowerclj/s

(toLower c)

Characters [A-F] will be transformed to [a-f], other chars will be returned unchanged.

Characters [A-F] will be transformed to [a-f], other chars will be returned unchanged.
sourceraw docstring

uppercase-base16-setclj/s

source

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

× close