Skip to main content

When to use these helpers

Use these helpers to total values, compare thresholds, round outputs, and calculate ratios. They are registered as functions and transforms.

Calling style

Call a helper as round($.requested_amount, 2). Not every helper is available everywhere: validation, form, and document-template helpers have distinct context contracts. Editor suggestions are not proof that a helper is supported at runtime.

Complete function reference

abs

Returns the absolute value of a number Signature: abs(x) Example:
Note: It can also be written as a transform when the first value is the input: value | abs(...).

acos

Returns the arccosine of a number Signature: acos(x) Example:
Note: It can also be written as a transform when the first value is the input: value | acos(...).

asin

Returns the arcsine of a number Signature: asin(x) Example:
Note: It can also be written as a transform when the first value is the input: value | asin(...).

atan

Returns the arctangent of a number Signature: atan(x) Example:
Note: It can also be written as a transform when the first value is the input: value | atan(...).

atan2

Returns the arctangent of the quotient of its arguments Signature: atan2(y, x) Example:
Note: It can also be written as a transform when the first value is the input: value | atan2(...).

avg

Returns the average of all arguments Signature: avg(...values) Example:
Note: It can also be written as a transform when the first value is the input: value | avg(...).

cbrt

Returns the cube root of a number Signature: cbrt(x) Example:
Note: It can also be written as a transform when the first value is the input: value | cbrt(...).

ceil

Returns the smallest integer greater than or equal to a number, with optional precision Signature: ceil(x, precision?) Example:
Note: It can also be written as a transform when the first value is the input: value | ceil(...).

clamp

Clamps a number between a minimum and maximum value Signature: clamp(value, min, max) Example:
Note: It can also be written as a transform when the first value is the input: value | clamp(...).

cos

Returns the cosine of a number (in radians) Signature: cos(x) Example:
Note: It can also be written as a transform when the first value is the input: value | cos(...).

exp

Returns e raised to the power of x Signature: exp(x) Example:
Note: It can also be written as a transform when the first value is the input: value | exp(...).

factorial

Calculates the factorial of a number Signature: factorial(n) Example:
Note: It can also be written as a transform when the first value is the input: value | factorial(...).

floor

Returns the largest integer less than or equal to a number, with optional precision Signature: floor(x, precision?) Example:
Note: It can also be written as a transform when the first value is the input: value | floor(...).

gcd

Calculates the greatest common divisor of two numbers Signature: gcd(a, b) Example:
Note: It can also be written as a transform when the first value is the input: value | gcd(...).

isPrime

Checks if a number is prime Signature: isPrime(n) Example:
Note: It can also be written as a transform when the first value is the input: value | isPrime(...).

lcm

Calculates the least common multiple of two numbers Signature: lcm(a, b) Example:
Note: It can also be written as a transform when the first value is the input: value | lcm(...).

lerp

Linear interpolation between two values Signature: lerp(start, end, t) Example:
Note: It can also be written as a transform when the first value is the input: value | lerp(...).

log

Returns the natural logarithm of a number Signature: log(x) Example:
Note: It can also be written as a transform when the first value is the input: value | log(...).

log10

Returns the base-10 logarithm of a number Signature: log10(x) Example:
Note: It can also be written as a transform when the first value is the input: value | log10(...).

log2

Returns the base-2 logarithm of a number Signature: log2(x) Example:
Note: It can also be written as a transform when the first value is the input: value | log2(...).

median

Returns the median of all arguments Signature: median(...values) Example:
Note: It can also be written as a transform when the first value is the input: value | median(...).

mode

Returns the mode (most frequent value) of all arguments Signature: mode(...values) Example:
Note: It can also be written as a transform when the first value is the input: value | mode(...).

pow

Returns the base raised to the power of the exponent Signature: pow(base, exponent) Example:
Note: It can also be written as a transform when the first value is the input: value | pow(...).

random

Returns a random number between 0 (inclusive) and 1 (exclusive) Signature: random() Example:
Note: It can also be written as a transform when the first value is the input: value | random(...).

round

Returns the value of a number rounded to the nearest integer, with optional precision Signature: round(x, precision?) Example:
Note: It can also be written as a transform when the first value is the input: value | round(...).

roundTo

Rounds a number to a specified number of decimal places Signature: roundTo(value, decimals) Example:
Note: It can also be written as a transform when the first value is the input: value | roundTo(...).

sign

Returns the sign of a number Signature: sign(x) Example:
Note: It can also be written as a transform when the first value is the input: value | sign(...).

sin

Returns the sine of a number (in radians) Signature: sin(x) Example:
Note: It can also be written as a transform when the first value is the input: value | sin(...).

sqrt

Returns the square root of a number Signature: sqrt(x) Example:
Note: It can also be written as a transform when the first value is the input: value | sqrt(...).

stddev

Returns the standard deviation of all arguments Signature: stddev(...values) Example:
Note: It can also be written as a transform when the first value is the input: value | stddev(...).

tan

Returns the tangent of a number (in radians) Signature: tan(x) Example:
Note: It can also be written as a transform when the first value is the input: value | tan(...).

toDegrees

Converts radians to degrees Signature: toDegrees(radians) Example:
Note: It can also be written as a transform when the first value is the input: value | toDegrees(...).

toRadians

Converts degrees to radians Signature: toRadians(degrees) Example:
Note: It can also be written as a transform when the first value is the input: value | toRadians(...).

trunc

Returns the integer part of a number by removing fractional digits Signature: trunc(x) Example:
Note: It can also be written as a transform when the first value is the input: value | trunc(...).

variance

Returns the variance of all arguments Signature: variance(...values) Example:
Note: It can also be written as a transform when the first value is the input: value | variance(...).

Before you publish

  • Start with a known value and confirm the expected result.
  • Handle null, empty text, and empty lists deliberately.
  • Do not place secrets, access tokens, or sensitive personal data in an expression.
  • Read expression contexts and availability before copying an expression between features.
Math helpers in KayanOS