On this page
Built-in functions reference
Look up text, array, math, time and request helpers.
Before you begin: Context and operators reference.
Built-In Functions
| Function | Purpose |
|---|---|
str.lower(value) | Lowercase a string. |
str.upper(value) | Uppercase a string. |
str.trim(value) | Trim a string. |
str.length(value) | Count a string’s length. Empty, missing, null, and non-string values return 0; values are not converted to text. |
str.includes(value, textOrArray) | Check whether a string contains one or more values. |
str.replace(value, search, replacement) | Replace all matching text. |
str.slice(value, start, end?) | Return part of a string. The start is inclusive, the optional end is exclusive, and negative positions count backward from the end. |
str.split(value, separator) | Split a string into an array, for example str.split("red,blue", ","). |
str.join(values, separator) | Join array values as strings. |
str.slug(...values) | Create a URL-friendly slug with a six-character random suffix to reduce collisions. |
arr.size(array) | Return array length. |
arr.map(array, fn) | Map array values. |
arr.join(array, separator) | Join array values. |
math.min(...values) | Return minimum. |
math.max(...values) | Return maximum. |
math.ceil(value) | Round up to the next whole number. |
time.now() | Return the current timestamp. |
time.add(value, { days, hours, minutes }) | Add time to a date value and return an ISO timestamp. |
random.id(length?) | Generate a secure alphanumeric id. |
random.uuid() | Generate a UUID. |
random.int(min, max) | Generate a secure integer in an inclusive range. With one argument, uses 0..max. |
random.number(min?, max?) | Generate a secure decimal number. With one argument, uses 0..max; with no arguments, uses 0..1. |
random.string(lengthOrOptions?, options?) | Generate a secure string from a named or custom alphabet. |
crypto.hash(algorithm, value, options?) | Hash a value with sha1, sha256, sha384, or sha512. |
crypto.sha256(value, options?) | Hash a value with SHA-256. |
crypto.sha384(value, options?) | Hash a value with SHA-384. |
crypto.sha512(value, options?) | Hash a value with SHA-512. |
crypto.hmac(algorithm, secret, payload, options?) | Sign a payload with HMAC. |
crypto.safeEqual(left, right, options?) | Compare signatures or tokens without leaking timing clues. |
crypto.verifyHmac(options) | Verify an HMAC signature and return true or false. |
http.get(url, options?) | Perform an approved HTTP GET request. |
http.post(url, options?) | Perform an approved HTTP POST request. |
http.put(url, options?) | Perform an approved HTTP PUT request. |
http.patch(url, options?) | Perform an approved HTTP PATCH request. |
http.delete(url, options?) | Perform an approved HTTP DELETE request. |
http.request(method, url, options?) | Perform an approved HTTP request with a dynamic method. |
console.log(...values) | Log from a rule run while developing. |
Use random.id(length) to generate a random identifier.
Use str.length to validate text lengths, and arr.size to count array items. Spaces count unless you trim the value first:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
A missing or null value has length 0, so the required-value check remains important. Non-string values also return 0; numbers and arrays are not converted to text. Length uses UTF-16 code units, so some emoji count as two rather than one.
str.slice uses zero-based positions and safely clamps positions outside the string. Omit end to continue through the rest of the value.
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Continue with Random and crypto reference.