proton.core

More commonly used utilities

as-boolean

(as-boolean s)
Returns a boolean represented by s. as-boolean returns true if s is "true"
or "yes", ignoring case, false if "false" or "no", and nil otherwise.

as-double

(as-double s)
Returns a new double number initialized to the value represented by s.
as-double returns nil if s is an illegal string or nil.

as-float

(as-float s)
Returns a new float number initialized to the value represented by s.
as-float returns nil if s is an illegal string or nil. as-float returns a
double number if s is out of float range.

as-int

(as-int s)
Returns a new integer number initialized to the value represented by s.
as-int returns nil if s is an illegal string or nil. as-long returns a
long number if s is out of int range.

as-long

(as-long s)
Returns a new long number initialized to the value represented by s.
as-int returns nil if s is an illegal string or nil.

as-rational

(as-rational s)
Returns a new rational number initialized to the value represented by s such
as "1", "1/2", and "-1/2". as-rational returns nil if s is an illegal
string, nil, or division by zero.

bytes->hex

(bytes->hex data)
Convert byte array to hex string.

clip

(clip x xmin xmax)
Limits x in the interval of [xmin xmax]. A value smaller than xmin becomes
xmin, and a value larger than xmax becomes xmax. If nil is supplied to
xmin/xmax, its side will not be limited.

deep-merge

(deep-merge & maps)
Recursively merges maps.

hex->bytes

(hex->bytes data)
Convert hex string to bytes array.

is-uuid?

(is-uuid? o)
Type check uuid object.

random-string

deprecated

(random-string length)
DEPRECATED: Use 'proton.string/rand-str' instead.
Generate random string from alphabets and numbers (i.e. 0-9, A-Z, and a-z)

stack-trace-string

(stack-trace-string e)
Returns a flattened string of stacktraces from an exception