[[functions]]
name = "chunk"
category = "array"
description = "Split array into chunks of size n"
signature = "array, number -> array"
examples = [
{ code = "chunk([1, 2, 3, 4], `2`) -> [[1, 2], [3, 4]]", description = "Basic chunking" },
{ code = "chunk([1, 2, 3, 4, 5], `2`) -> [[1, 2], [3, 4], [5]]", description = "Uneven chunks" },
{ code = "chunk([], `2`) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "compact"
category = "array"
description = "Remove null values from array"
signature = "array -> array"
examples = [
{ code = "compact([1, null, 2, null]) -> [1, 2]", description = "Remove nulls" },
{ code = "compact([null, null]) -> []", description = "All nulls" },
{ code = "compact([1, 2, 3]) -> [1, 2, 3]", description = "No nulls" },
]
features = ["core"]
[[functions]]
name = "difference"
category = "array"
description = "Elements in first array not in second"
signature = "array, array -> array"
examples = [
{ code = "difference([1, 2, 3], [2]) -> [1, 3]", description = "Remove matching elements" },
{ code = "difference([1, 2, 3], [4, 5]) -> [1, 2, 3]", description = "No overlap" },
{ code = "difference([1, 2], [1, 2]) -> []", description = "All removed" },
]
features = ["core"]
[[functions]]
name = "drop"
category = "array"
description = "Drop first n elements"
signature = "array, number -> array"
examples = [
{ code = "drop([1, 2, 3, 4], `2`) -> [3, 4]", description = "Drop first 2" },
{ code = "drop([1, 2, 3], `0`) -> [1, 2, 3]", description = "Drop none" },
{ code = "drop([1, 2], `5`) -> []", description = "Drop more than length" },
]
features = ["core"]
[[functions]]
name = "find_index"
category = "array"
description = "Find index of value in array"
signature = "array, any -> number | null"
examples = [
{ code = "find_index([1, 2, 3], `2`) -> 1", description = "Find existing value" },
{ code = "find_index(['a', 'b', 'c'], 'b') -> 1", description = "Find string" },
{ code = "find_index([1, 2, 3], `99`) -> null", description = "Value not found" },
]
features = ["core"]
[[functions]]
name = "first"
category = "array"
description = "Get first element of array"
signature = "array -> any"
examples = [
{ code = "first([1, 2, 3]) -> 1", description = "Get first number" },
{ code = "first(['a', 'b']) -> 'a'", description = "Get first string" },
{ code = "first([]) -> null", description = "Empty array returns null" },
]
features = ["core"]
[[functions]]
name = "flatten"
category = "array"
description = "Flatten array one level deep"
signature = "array -> array"
examples = [
{ code = "flatten([[1, 2], [3]]) -> [1, 2, 3]", description = "Flatten nested arrays" },
{ code = "flatten([[1, [2]], [3]]) -> [1, [2], 3]", description = "Only one level deep" },
{ code = "flatten([1, 2, 3]) -> [1, 2, 3]", description = "Already flat" },
]
features = ["core"]
[[functions]]
name = "flatten_deep"
category = "array"
description = "Recursively flatten nested arrays"
signature = "array -> array"
examples = [
{ code = "flatten_deep([[1, [2]], [3]]) -> [1, 2, 3]", description = "Deeply nested" },
{ code = "flatten_deep([[[1]], [[2]], [[3]]]) -> [1, 2, 3]", description = "Multiple levels" },
{ code = "flatten_deep([1, 2, 3]) -> [1, 2, 3]", description = "Already flat" },
]
features = ["core"]
[[functions]]
name = "frequencies"
category = "array"
description = "Count occurrences of each value"
signature = "array -> object"
examples = [
{ code = "frequencies(['a', 'b', 'a']) -> {a: 2, b: 1}", description = "Count strings" },
{ code = "frequencies([1, 2, 1, 1]) -> {1: 3, 2: 1}", description = "Count numbers" },
{ code = "frequencies([]) -> {}", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "group_by"
category = "array"
description = "Group array elements by key"
signature = "array, string -> object"
examples = [
{ code = "group_by([{t: 'a'}, {t: 'b'}, {t: 'a'}], 't') -> {a: [{t:'a'}, {t:'a'}], b: [{t:'b'}]}", description = "Group by field" },
{ code = "group_by(users, 'role') -> {admin: [...], user: [...]}", description = "Group users by role" },
{ code = "group_by([], 'key') -> {}", description = "Empty array returns empty object" },
]
features = ["core"]
[[functions]]
name = "includes"
category = "array"
description = "Check if array contains value"
signature = "array, any -> boolean"
examples = [
{ code = "includes([1, 2, 3], `2`) -> true", description = "Value found" },
{ code = "includes([1, 2, 3], `99`) -> false", description = "Value not found" },
{ code = "includes(['a', 'b'], 'a') -> true", description = "String value" },
]
features = ["core"]
[[functions]]
name = "index_at"
category = "array"
description = "Get element at index (supports negative)"
signature = "array, number -> any"
examples = [
{ code = "index_at([1, 2, 3], `0`) -> 1", description = "First element" },
{ code = "index_at([1, 2, 3], `-1`) -> 3", description = "Last element (negative index)" },
{ code = "index_at([1, 2, 3], `99`) -> null", description = "Out of bounds" },
]
features = ["core"]
[[functions]]
name = "intersection"
category = "array"
description = "Elements common to both arrays"
signature = "array, array -> array"
examples = [
{ code = "intersection([1, 2], [2, 3]) -> [2]", description = "Common elements" },
{ code = "intersection([1, 2], [3, 4]) -> []", description = "No overlap" },
{ code = "intersection([1, 2, 3], [1, 2, 3]) -> [1, 2, 3]", description = "Identical arrays" },
]
features = ["core"]
[[functions]]
name = "last"
category = "array"
description = "Get last element of array"
signature = "array -> any"
examples = [
{ code = "last([1, 2, 3]) -> 3", description = "Get last number" },
{ code = "last(['a', 'b']) -> 'b'", description = "Get last string" },
{ code = "last([]) -> null", description = "Empty array returns null" },
]
features = ["core"]
[[functions]]
name = "pairwise"
category = "array"
description = "Return adjacent pairs from array"
signature = "array -> array"
examples = [
{ code = "pairwise([1, 2, 3]) -> [[1, 2], [2, 3]]", description = "Adjacent pairs" },
{ code = "pairwise([1, 2]) -> [[1, 2]]", description = "Single pair" },
{ code = "pairwise([1]) -> []", description = "Too few elements" },
]
features = ["core"]
[[functions]]
name = "range"
category = "array"
description = "Generate array of numbers"
signature = "number, number -> array"
examples = [
{ code = "range(`1`, `5`) -> [1, 2, 3, 4]", description = "Range 1 to 4" },
{ code = "range(`0`, `3`) -> [0, 1, 2]", description = "Range from zero" },
{ code = "range(`5`, `5`) -> []", description = "Empty range" },
]
features = ["core"]
[[functions]]
name = "sliding_window"
category = "array"
description = "Create overlapping windows of size n (alias for window)"
signature = "array, number -> array"
examples = [
{ code = "sliding_window([1, 2, 3, 4], `2`) -> [[1, 2], [2, 3], [3, 4]]", description = "Size 2 windows" },
{ code = "sliding_window([1, 2, 3, 4], `3`) -> [[1, 2, 3], [2, 3, 4]]", description = "Size 3 windows" },
{ code = "sliding_window([1, 2], `3`) -> []", description = "Window larger than array" },
]
aliases = ["window"]
features = ["core"]
[[functions]]
name = "take"
category = "array"
description = "Take first n elements"
signature = "array, number -> array"
examples = [
{ code = "take([1, 2, 3, 4], `2`) -> [1, 2]", description = "Take first 2" },
{ code = "take([1, 2, 3], `0`) -> []", description = "Take none" },
{ code = "take([1, 2], `5`) -> [1, 2]", description = "Take more than length" },
]
features = ["core"]
[[functions]]
name = "transpose"
category = "array"
description = "Transpose a 2D array (swap rows and columns)"
signature = "array -> array"
examples = [
{ code = "transpose([[1, 2], [3, 4]]) -> [[1, 3], [2, 4]]", description = "Swap rows/columns" },
{ code = "transpose([[1, 2, 3], [4, 5, 6]]) -> [[1, 4], [2, 5], [3, 6]]", description = "2x3 to 3x2" },
{ code = "transpose([]) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "union"
category = "array"
description = "Unique elements from both arrays"
signature = "array, array -> array"
examples = [
{ code = "union([1, 2], [2, 3]) -> [1, 2, 3]", description = "Combine with dedup" },
{ code = "union([1, 2], [3, 4]) -> [1, 2, 3, 4]", description = "No overlap" },
{ code = "union([], [1, 2]) -> [1, 2]", description = "Empty first array" },
]
features = ["core"]
[[functions]]
name = "unique"
category = "array"
description = "Remove duplicate values"
signature = "array -> array"
examples = [
{ code = "unique([1, 2, 1, 3]) -> [1, 2, 3]", description = "Basic deduplication" },
{ code = "unique(['a', 'b', 'a']) -> ['a', 'b']", description = "String values" },
{ code = "unique([]) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "zip"
category = "array"
description = "Zip two arrays together"
signature = "array, array -> array"
examples = [
{ code = "zip([1, 2], ['a', 'b']) -> [[1, 'a'], [2, 'b']]", description = "Basic zip" },
{ code = "zip([1, 2, 3], ['a', 'b']) -> [[1, 'a'], [2, 'b']]", description = "Unequal lengths (truncates)" },
{ code = "zip([], []) -> []", description = "Empty arrays" },
]
jep = "JEP-013"
features = ["core", "jep"]
[[functions]]
name = "color_complement"
category = "color"
description = "Get complementary color"
signature = "string -> string"
examples = [
{ code = '''color_complement('#ff0000') -> \"#00ffff\"''', description = "Red to cyan" },
{ code = '''color_complement('#00ff00') -> \"#ff00ff\"''', description = "Green to magenta" },
{ code = '''color_complement('#0000ff') -> \"#ffff00\"''', description = "Blue to yellow" },
]
features = ["core"]
[[functions]]
name = "color_grayscale"
category = "color"
description = "Convert to grayscale"
signature = "string -> string"
examples = [
{ code = '''color_grayscale('#ff0000') -> \"#4c4c4c\"''', description = "Red to gray" },
{ code = '''color_grayscale('#00ff00') -> \"#969696\"''', description = "Green to gray" },
{ code = '''color_grayscale('#ffffff') -> \"#ffffff\"''', description = "White unchanged" },
]
features = ["core"]
[[functions]]
name = "color_invert"
category = "color"
description = "Invert a color"
signature = "string -> string"
examples = [
{ code = '''color_invert('#ff0000') -> \"#00ffff\"''', description = "Invert red" },
{ code = '''color_invert('#000000') -> \"#ffffff\"''', description = "Black to white" },
{ code = '''color_invert('#ffffff') -> \"#000000\"''', description = "White to black" },
]
features = ["core"]
[[functions]]
name = "color_mix"
category = "color"
description = "Mix two colors"
signature = "string, string, number -> string"
examples = [
{ code = '''color_mix('#ff0000', '#0000ff', `50`) -> \"#800080\"''', description = "Red and blue to purple" },
{ code = '''color_mix('#ff0000', '#00ff00', `50`) -> \"#808000\"''', description = "Red and green" },
{ code = '''color_mix('#000000', '#ffffff', `50`) -> \"#808080\"''', description = "Black and white to gray" },
]
features = ["core"]
[[functions]]
name = "darken"
category = "color"
description = "Darken a color by percentage"
signature = "string, number -> string"
examples = [
{ code = '''darken('#3366cc', `20`) -> \"#2952a3\"''', description = "Darken blue by 20%" },
{ code = '''darken('#ff0000', `50`) -> \"#800000\"''', description = "Darken red by 50%" },
{ code = '''darken('#ffffff', `100`) -> \"#000000\"''', description = "White to black" },
]
features = ["core"]
[[functions]]
name = "hex_to_rgb"
category = "color"
description = "Convert hex color to RGB"
signature = "string -> object"
examples = [
{ code = "hex_to_rgb('#ff5500') -> {b: 0, g: 85, r: 255}", description = "Orange" },
{ code = "hex_to_rgb('#000000') -> {b: 0, g: 0, r: 0}", description = "Black" },
{ code = "hex_to_rgb('#ffffff') -> {b: 255, g: 255, r: 255}", description = "White" },
]
features = ["core"]
[[functions]]
name = "lighten"
category = "color"
description = "Lighten a color by percentage"
signature = "string, number -> string"
examples = [
{ code = '''lighten('#3366cc', `20`) -> \"#5c85d6\"''', description = "Lighten blue by 20%" },
{ code = '''lighten('#800000', `50`) -> \"#ff0000\"''', description = "Lighten dark red" },
{ code = '''lighten('#000000', `100`) -> \"#ffffff\"''', description = "Black to white" },
]
features = ["core"]
[[functions]]
name = "rgb_to_hex"
category = "color"
description = "Convert RGB to hex color"
signature = "number, number, number -> string"
examples = [
{ code = '''rgb_to_hex(`255`, `85`, `0`) -> \"#ff5500\"''', description = "Orange" },
{ code = '''rgb_to_hex(`0`, `0`, `0`) -> \"#000000\"''', description = "Black" },
{ code = '''rgb_to_hex(`255`, `255`, `255`) -> \"#ffffff\"''', description = "White" },
]
features = ["core"]
[[functions]]
name = "bit_and"
category = "computing"
description = "Bitwise AND"
signature = "number, number -> number"
examples = [
{ code = "bit_and(`12`, `10`) -> 8", description = "1100 AND 1010 = 1000" },
{ code = "bit_and(`255`, `15`) -> 15", description = "Mask lower 4 bits" },
{ code = "bit_and(`7`, `3`) -> 3", description = "0111 AND 0011 = 0011" },
]
features = ["core"]
[[functions]]
name = "bit_not"
category = "computing"
description = "Bitwise NOT"
signature = "number -> number"
examples = [
{ code = "bit_not(`0`) -> -1", description = "Invert zero" },
{ code = "bit_not(`-1`) -> 0", description = "Invert all ones" },
{ code = "bit_not(`1`) -> -2", description = "Invert one" },
]
features = ["core"]
[[functions]]
name = "bit_or"
category = "computing"
description = "Bitwise OR"
signature = "number, number -> number"
examples = [
{ code = "bit_or(`12`, `10`) -> 14", description = "1100 OR 1010 = 1110" },
{ code = "bit_or(`1`, `2`) -> 3", description = "0001 OR 0010 = 0011" },
{ code = "bit_or(`0`, `255`) -> 255", description = "Zero OR any = any" },
]
features = ["core"]
[[functions]]
name = "bit_shift_left"
category = "computing"
description = "Bitwise left shift"
signature = "number, number -> number"
examples = [
{ code = "bit_shift_left(`1`, `4`) -> 16", description = "Shift 1 left by 4" },
{ code = "bit_shift_left(`1`, `0`) -> 1", description = "Shift by 0 unchanged" },
{ code = "bit_shift_left(`5`, `2`) -> 20", description = "Multiply by 4" },
]
features = ["core"]
[[functions]]
name = "bit_shift_right"
category = "computing"
description = "Bitwise right shift"
signature = "number, number -> number"
examples = [
{ code = "bit_shift_right(`16`, `2`) -> 4", description = "Divide by 4" },
{ code = "bit_shift_right(`255`, `4`) -> 15", description = "Shift right by 4" },
{ code = "bit_shift_right(`8`, `0`) -> 8", description = "Shift by 0 unchanged" },
]
features = ["core"]
[[functions]]
name = "bit_xor"
category = "computing"
description = "Bitwise XOR"
signature = "number, number -> number"
examples = [
{ code = "bit_xor(`12`, `10`) -> 6", description = "1100 XOR 1010 = 0110" },
{ code = "bit_xor(`255`, `255`) -> 0", description = "Same values = 0" },
{ code = "bit_xor(`5`, `3`) -> 6", description = "0101 XOR 0011 = 0110" },
]
features = ["core"]
[[functions]]
name = "format_bytes"
category = "computing"
description = "Format bytes (decimal)"
signature = "number -> string"
examples = [
{ code = '''format_bytes(`1500000000`) -> \"1.50 GB\"''', description = "Gigabytes" },
{ code = '''format_bytes(`1000`) -> \"1.00 KB\"''', description = "Kilobytes" },
{ code = '''format_bytes(`500`) -> \"500 B\"''', description = "Bytes" },
]
features = ["core"]
[[functions]]
name = "format_bytes_binary"
category = "computing"
description = "Format bytes (binary)"
signature = "number -> string"
examples = [
{ code = '''format_bytes_binary(`1073741824`) -> \"1.00 GiB\"''', description = "Gibibytes" },
{ code = '''format_bytes_binary(`1024`) -> \"1.00 KiB\"''', description = "Kibibytes" },
{ code = '''format_bytes_binary(`1048576`) -> \"1.00 MiB\"''', description = "Mebibytes" },
]
features = ["core"]
[[functions]]
name = "parse_bytes"
category = "computing"
description = "Parse byte size string"
signature = "string -> number"
examples = [
{ code = "parse_bytes('1.5 GB') -> 1500000000", description = "Gigabytes" },
{ code = "parse_bytes('1 KB') -> 1000", description = "Kilobytes" },
{ code = "parse_bytes('1 GiB') -> 1073741824", description = "Gibibytes" },
]
features = ["core"]
[[functions]]
name = "business_days_between"
category = "datetime"
description = "Count business days (weekdays) between two timestamps"
signature = "number, number -> number"
examples = [
{ code = "business_days_between(`1704067200`, `1705276800`) -> 10", description = "Count weekdays" },
{ code = "business_days_between(start_ts, end_ts) -> count", description = "Between two timestamps" },
{ code = "business_days_between(`0`, `604800`) -> 5", description = "One week = 5 days" },
{ code = "business_days_between(`0`, `0`) -> 0", description = "Same day" },
]
features = ["core"]
[[functions]]
name = "date_add"
category = "datetime"
description = "Add time to timestamp"
signature = "number, number, string -> number"
examples = [
{ code = "date_add(`0`, `1`, 'days') -> 86400", description = "Add 1 day" },
{ code = "date_add(`0`, `2`, 'hours') -> 7200", description = "Add 2 hours" },
{ code = "date_add(timestamp, `7`, 'days') -> next week", description = "Add 1 week" },
{ code = "date_add(`0`, `30`, 'minutes') -> 1800", description = "Add 30 minutes" },
]
features = ["core"]
[[functions]]
name = "date_diff"
category = "datetime"
description = "Difference between timestamps"
signature = "number, number, string -> number"
examples = [
{ code = "date_diff(`86400`, `0`, 'days') -> 1", description = "Diff in days" },
{ code = "date_diff(`7200`, `0`, 'hours') -> 2", description = "Diff in hours" },
{ code = "date_diff(end_ts, start_ts, 'minutes') -> minutes", description = "Diff in minutes" },
{ code = "date_diff(`604800`, `0`, 'weeks') -> 1", description = "Diff in weeks" },
]
features = ["core"]
[[functions]]
name = "duration_since"
category = "datetime"
description = "Get detailed duration object from timestamp to now"
signature = "number|string -> object"
examples = [
{ code = "duration_since(`1702396800`) -> {days: 1, hours: 0, ...}", description = "From timestamp" },
{ code = "duration_since('2023-01-01') -> {days: N, ...}", description = "From date string" },
{ code = "duration_since(created_at) -> elapsed time", description = "Time since creation" },
{ code = "duration_since(now() - 3600) -> {hours: 1, ...}", description = "One hour ago" },
]
features = ["core"]
[[functions]]
name = "end_of_day"
category = "datetime"
description = "Get ISO 8601 string for end of day (23:59:59)"
signature = "number|string -> string"
examples = [
{ code = '''end_of_day('2023-12-13T15:30:00Z') -> \"2023-12-13T23:59:59Z\"''', description = "From ISO string" },
{ code = "end_of_day(`1702483200`) -> end of that day", description = "From timestamp" },
{ code = "end_of_day('2024-01-01') -> last second of day", description = "From date only" },
{ code = "end_of_day(now()) -> today end", description = "End of today" },
]
features = ["core"]
[[functions]]
name = "epoch_ms"
category = "datetime"
description = "Current Unix timestamp in milliseconds (alias for now_ms)"
signature = "-> number"
examples = [
{ code = "epoch_ms() -> 1702483200000", description = "Current time in ms" },
{ code = "epoch_ms() / `1000` -> seconds", description = "Convert to seconds" },
{ code = "epoch_ms() - start_ms -> elapsed", description = "Calculate duration" },
]
features = ["core"]
[[functions]]
name = "format_date"
category = "datetime"
description = "Format timestamp to string"
signature = "number, string -> string"
examples = [
{ code = '''format_date(`1705276800`, '%Y-%m-%d') -> \"2024-01-15\"''', description = "ISO date format" },
{ code = '''format_date(ts, '%B %d, %Y') -> \"January 15, 2024\"''', description = "Long date format" },
{ code = '''format_date(ts, '%H:%M:%S') -> \"10:30:00\"''', description = "Time only" },
{ code = '''format_date(ts, '%Y-%m-%dT%H:%M:%SZ') -> ISO string''', description = "Full ISO 8601" },
]
features = ["core"]
[[functions]]
name = "from_epoch"
category = "datetime"
description = "Convert Unix timestamp (seconds) to ISO 8601 string"
signature = "number -> string"
examples = [
{ code = '''from_epoch(`1702483200`) -> \"2023-12-13T16:00:00Z\"''', description = "Convert seconds" },
{ code = '''from_epoch(`0`) -> \"1970-01-01T00:00:00Z\"''', description = "Unix epoch" },
{ code = "from_epoch(created_at) -> ISO string", description = "Convert field" },
{ code = "from_epoch(now()) -> current ISO", description = "Current time" },
]
features = ["core"]
[[functions]]
name = "from_epoch_ms"
category = "datetime"
description = "Convert Unix timestamp (milliseconds) to ISO 8601 string"
signature = "number -> string"
examples = [
{ code = '''from_epoch_ms(`1702483200000`) -> \"2023-12-13T16:00:00Z\"''', description = "From milliseconds" },
{ code = '''from_epoch_ms(`0`) -> \"1970-01-01T00:00:00Z\"''', description = "Unix epoch" },
{ code = "from_epoch_ms(js_timestamp) -> ISO", description = "JS timestamp" },
{ code = "from_epoch_ms(epoch_ms()) -> current", description = "Current time" },
]
features = ["core"]
[[functions]]
name = "is_after"
category = "datetime"
description = "Check if first date is after second date (accepts timestamps or date strings)"
signature = "number|string, number|string -> boolean"
examples = [
{ code = "is_after('2024-07-15', '2024-01-01') -> true", description = "String comparison" },
{ code = "is_after(`1705276800`, `1704067200`) -> true", description = "Timestamp comparison" },
{ code = "is_after(end_date, start_date) -> true/false", description = "Field comparison" },
{ code = "is_after('2024-01-01', '2024-01-01') -> false", description = "Same date" },
]
features = ["core"]
[[functions]]
name = "is_before"
category = "datetime"
description = "Check if first date is before second date (accepts timestamps or date strings)"
signature = "number|string, number|string -> boolean"
examples = [
{ code = "is_before('2024-01-01', '2024-07-15') -> true", description = "String comparison" },
{ code = "is_before(`1704067200`, `1705276800`) -> true", description = "Timestamp comparison" },
{ code = "is_before(start_date, end_date) -> true/false", description = "Field comparison" },
{ code = "is_before('2024-01-01', '2024-01-01') -> false", description = "Same date" },
]
features = ["core"]
[[functions]]
name = "is_between"
category = "datetime"
description = "Check if date is between start and end (inclusive, accepts timestamps or date strings)"
signature = "number|string, number|string, number|string -> boolean"
examples = [
{ code = "is_between('2024-06-15', '2024-01-01', '2024-12-31') -> true", description = "Within range" },
{ code = "is_between('2023-06-15', '2024-01-01', '2024-12-31') -> false", description = "Before range" },
{ code = "is_between(event_date, start, end) -> true/false", description = "Check event date" },
{ code = "is_between('2024-01-01', '2024-01-01', '2024-12-31') -> true", description = "Inclusive start" },
]
features = ["core"]
[[functions]]
name = "is_same_day"
category = "datetime"
description = "Check if two timestamps/dates are on the same day"
signature = "number|string, number|string -> boolean"
examples = [
{ code = "is_same_day('2023-12-13T10:00:00Z', '2023-12-13T23:00:00Z') -> true", description = "Same day, different time" },
{ code = "is_same_day('2023-12-13', '2023-12-14') -> false", description = "Different days" },
{ code = "is_same_day(created_at, updated_at) -> true/false", description = "Compare fields" },
{ code = "is_same_day(now(), event_time) -> true/false", description = "Today check" },
]
features = ["core"]
[[functions]]
name = "is_weekday"
category = "datetime"
description = "Check if timestamp falls on weekday (Monday-Friday)"
signature = "number -> boolean"
examples = [
{ code = "is_weekday(`1705276800`) -> true", description = "Monday is weekday" },
{ code = "is_weekday(now()) -> true/false", description = "Check current day" },
{ code = "is_weekday(event_timestamp) -> true/false", description = "Check event day" },
{ code = "is_weekday(`1705104000`) -> false", description = "Saturday is not weekday" },
]
features = ["core"]
[[functions]]
name = "is_weekend"
category = "datetime"
description = "Check if timestamp falls on weekend (Saturday or Sunday)"
signature = "number -> boolean"
examples = [
{ code = "is_weekend(`1705104000`) -> true", description = "Saturday is weekend" },
{ code = "is_weekend(now()) -> true/false", description = "Check current day" },
{ code = "is_weekend(`1705276800`) -> false", description = "Monday is not weekend" },
{ code = "is_weekend(event_timestamp) -> true/false", description = "Check event day" },
]
features = ["core"]
[[functions]]
name = "parse_date"
category = "datetime"
description = "Parse date string to timestamp"
signature = "string, string? -> number"
examples = [
{ code = "parse_date('2024-01-15', '%Y-%m-%d') -> 1705276800", description = "ISO date format" },
{ code = "parse_date('01/15/2024', '%m/%d/%Y') -> timestamp", description = "US date format" },
{ code = "parse_date('15-Jan-2024', '%d-%b-%Y') -> timestamp", description = "Named month" },
{ code = "parse_date('2024-01-15T10:30:00', '%Y-%m-%dT%H:%M:%S') -> timestamp", description = "With time" },
]
features = ["core"]
[[functions]]
name = "quarter"
category = "datetime"
description = "Get quarter of year (1-4) from timestamp"
signature = "number -> number"
examples = [
{ code = "quarter(`1713139200`) -> 2", description = "April is Q2" },
{ code = "quarter(`1704067200`) -> 1", description = "January is Q1" },
{ code = "quarter(`1719792000`) -> 3", description = "July is Q3" },
{ code = "quarter(`1730419200`) -> 4", description = "November is Q4" },
]
features = ["core"]
[[functions]]
name = "relative_time"
category = "datetime"
description = "Human-readable relative time from timestamp"
signature = "number -> string"
examples = [
{ code = '''relative_time(now() - 3600) -> \"1 hour ago\"''', description = "One hour ago" },
{ code = '''relative_time(now() - 60) -> \"1 minute ago\"''', description = "One minute ago" },
{ code = '''relative_time(now() - 86400) -> \"1 day ago\"''', description = "One day ago" },
{ code = "relative_time(created_at) -> human readable", description = "From field" },
]
features = ["core"]
[[functions]]
name = "start_of_day"
category = "datetime"
description = "Get ISO 8601 string for start of day (00:00:00)"
signature = "number|string -> string"
examples = [
{ code = '''start_of_day('2023-12-13T15:30:00Z') -> \"2023-12-13T00:00:00Z\"''', description = "From ISO string" },
{ code = "start_of_day(`1702483200`) -> start of that day", description = "From timestamp" },
{ code = "start_of_day(now()) -> today midnight", description = "Today start" },
{ code = "start_of_day('2024-01-15') -> midnight", description = "From date only" },
]
features = ["core"]
[[functions]]
name = "start_of_month"
category = "datetime"
description = "Get ISO 8601 string for start of month"
signature = "number|string -> string"
examples = [
{ code = '''start_of_month('2023-12-13T15:30:00Z') -> \"2023-12-01T00:00:00Z\"''', description = "From ISO string" },
{ code = "start_of_month(now()) -> first of month", description = "Current month start" },
{ code = "start_of_month(`1702483200`) -> month start", description = "From timestamp" },
{ code = '''start_of_month('2024-03-15') -> \"2024-03-01T00:00:00Z\"''', description = "March start" },
]
features = ["core"]
[[functions]]
name = "start_of_week"
category = "datetime"
description = "Get ISO 8601 string for start of week (Monday 00:00:00)"
signature = "number|string -> string"
examples = [
{ code = '''start_of_week('2023-12-13T15:30:00Z') -> \"2023-12-11T00:00:00Z\"''', description = "Wednesday to Monday" },
{ code = "start_of_week(now()) -> this Monday", description = "Current week start" },
{ code = "start_of_week(`1702483200`) -> week start", description = "From timestamp" },
{ code = '''start_of_week('2024-01-15') -> \"2024-01-15T00:00:00Z\"''', description = "Monday stays Monday" },
]
features = ["core"]
[[functions]]
name = "start_of_year"
category = "datetime"
description = "Get ISO 8601 string for start of year"
signature = "number|string -> string"
examples = [
{ code = '''start_of_year('2023-12-13T15:30:00Z') -> \"2023-01-01T00:00:00Z\"''', description = "From ISO string" },
{ code = "start_of_year(now()) -> Jan 1st", description = "Current year start" },
{ code = "start_of_year(`1702483200`) -> year start", description = "From timestamp" },
{ code = '''start_of_year('2024-06-15') -> \"2024-01-01T00:00:00Z\"''', description = "Mid-year to Jan 1" },
]
features = ["core"]
[[functions]]
name = "time_ago"
category = "datetime"
description = "Human-readable time since date (accepts timestamps or date strings)"
signature = "number|string -> string"
examples = [
{ code = '''time_ago('2020-01-01') -> \"4 years ago\"''', description = "From date string" },
{ code = '''time_ago(now() - 3600) -> \"1 hour ago\"''', description = "One hour ago" },
{ code = "time_ago(created_at) -> human readable", description = "From field" },
{ code = '''time_ago('2023-12-01') -> \"X months ago\"''', description = "Months ago" },
]
features = ["core"]
[[functions]]
name = "timezone_convert"
category = "datetime"
description = "Convert timestamp between timezones (IANA timezone names)"
signature = "string, string, string -> string"
examples = [
{ code = '''timezone_convert('2024-01-15T10:00:00', 'America/New_York', 'Europe/London') -> \"2024-01-15T15:00:00\"''', description = "NY to London" },
{ code = "timezone_convert(time, 'UTC', 'America/Los_Angeles') -> PST time", description = "UTC to Pacific" },
{ code = "timezone_convert(time, 'Asia/Tokyo', 'UTC') -> UTC time", description = "Tokyo to UTC" },
{ code = "timezone_convert(time, 'Europe/Paris', 'America/Chicago') -> CST time", description = "Paris to Chicago" },
]
features = ["core"]
[[functions]]
name = "to_epoch"
category = "datetime"
description = "Convert date string or timestamp to Unix timestamp (seconds)"
signature = "number|string -> number"
examples = [
{ code = "to_epoch('2023-12-13T16:00:00Z') -> 1702483200", description = "From ISO string" },
{ code = "to_epoch('2024-01-01') -> timestamp", description = "From date only" },
{ code = "to_epoch(date_field) -> seconds", description = "Convert field" },
{ code = "to_epoch('1970-01-01T00:00:00Z') -> 0", description = "Unix epoch" },
]
features = ["core"]
[[functions]]
name = "to_epoch_ms"
category = "datetime"
description = "Convert date string or timestamp to Unix timestamp (milliseconds)"
signature = "number|string -> number"
examples = [
{ code = "to_epoch_ms('2023-12-13T16:00:00Z') -> 1702483200000", description = "From ISO string" },
{ code = "to_epoch_ms('2024-01-01') -> timestamp_ms", description = "From date only" },
{ code = "to_epoch_ms(date_field) -> milliseconds", description = "Convert field" },
{ code = "to_epoch_ms('1970-01-01T00:00:00Z') -> 0", description = "Unix epoch" },
]
features = ["core"]
[[functions]]
name = "duration_hours"
category = "duration"
description = "Convert seconds to hours"
signature = "number -> number"
examples = [
{ code = "duration_hours(`7200`) -> 2", description = "2 hours" },
{ code = "duration_hours(`3600`) -> 1", description = "1 hour" },
{ code = "duration_hours(`5400`) -> 1.5", description = "1.5 hours" },
]
features = ["core"]
[[functions]]
name = "duration_minutes"
category = "duration"
description = "Convert seconds to minutes"
signature = "number -> number"
examples = [
{ code = "duration_minutes(`120`) -> 2", description = "2 minutes" },
{ code = "duration_minutes(`60`) -> 1", description = "1 minute" },
{ code = "duration_minutes(`90`) -> 1.5", description = "1.5 minutes" },
]
features = ["core"]
[[functions]]
name = "duration_seconds"
category = "duration"
description = "Get seconds component"
signature = "number -> number"
examples = [
{ code = "duration_seconds(`65`) -> 5", description = "65 seconds mod 60" },
{ code = "duration_seconds(`120`) -> 0", description = "Exact minutes" },
{ code = "duration_seconds(`3661`) -> 1", description = "1 hour 1 min 1 sec" },
]
features = ["core"]
[[functions]]
name = "format_duration"
category = "duration"
description = "Format seconds as duration string"
signature = "number -> string"
examples = [
{ code = '''format_duration(`5400`) -> \"1h30m\"''', description = "1.5 hours" },
{ code = '''format_duration(`3661`) -> \"1h1m1s\"''', description = "1 hour 1 min 1 sec" },
{ code = '''format_duration(`60`) -> \"1m\"''', description = "1 minute" },
]
features = ["core"]
[[functions]]
name = "parse_duration"
category = "duration"
description = "Parse duration string to seconds"
signature = "string -> number"
examples = [
{ code = "parse_duration('1h30m') -> 5400", description = "1.5 hours" },
{ code = "parse_duration('2h') -> 7200", description = "2 hours" },
{ code = "parse_duration('30s') -> 30", description = "30 seconds" },
]
features = ["core"]
[[functions]]
name = "base64_decode"
category = "encoding"
description = "Decode base64 string"
signature = "string -> string"
examples = [
{ code = '''base64_decode('aGVsbG8=') -> \"hello\"''', description = "Decode hello" },
{ code = '''base64_decode('dGVzdA==') -> \"test\"''', description = "Decode test" },
{ code = '''base64_decode('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "base64_encode"
category = "encoding"
description = "Encode string to base64"
signature = "string -> string"
examples = [
{ code = '''base64_encode('hello') -> \"aGVsbG8=\"''', description = "Encode hello" },
{ code = '''base64_encode('test') -> \"dGVzdA==\"''', description = "Encode test" },
{ code = '''base64_encode('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "hex_decode"
category = "encoding"
description = "Decode hex string"
signature = "string -> string"
examples = [
{ code = '''hex_decode('68656c6c6f') -> \"hello\"''', description = "Decode hello" },
{ code = '''hex_decode('74657374') -> \"test\"''', description = "Decode test" },
{ code = '''hex_decode('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "hex_encode"
category = "encoding"
description = "Encode string to hex"
signature = "string -> string"
examples = [
{ code = '''hex_encode('hello') -> \"68656c6c6f\"''', description = "Encode hello" },
{ code = '''hex_encode('test') -> \"74657374\"''', description = "Encode test" },
{ code = '''hex_encode('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "jwt_decode"
category = "encoding"
description = "Decode JWT payload (claims) without verification"
signature = "string -> object"
examples = [
{ code = '''jwt_decode('eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyXzEyMyJ9.sig').sub -> \"user_123\"''', description = "Extract subject claim" },
{ code = "jwt_decode('eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiSm9obiJ9.sig').name -> 'John'", description = "Extract name claim" },
]
features = ["core"]
[[functions]]
name = "jwt_header"
category = "encoding"
description = "Decode JWT header without verification"
signature = "string -> object"
examples = [
{ code = '''jwt_header('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.payload.sig').alg -> \"HS256\"''', description = "Extract algorithm" },
{ code = '''jwt_header('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.payload.sig').typ -> \"JWT\"''', description = "Extract type" },
]
features = ["core"]
[[functions]]
name = "html_escape"
category = "encoding"
description = "Escape HTML special characters"
signature = "string -> string"
examples = [
{ code = '''html_escape('<div>') -> \"<div>\"''', description = "Escape tags" },
{ code = '''html_escape('a & b') -> \"a & b\"''', description = "Escape ampersand" },
{ code = '''html_escape('\"quoted\"') -> \""quoted"\"''', description = "Escape quotes" },
{ code = "html_escape(user_input) -> safe for HTML", description = "Sanitize input" },
]
features = ["core"]
[[functions]]
name = "html_unescape"
category = "encoding"
description = "Unescape HTML entities"
signature = "string -> string"
examples = [
{ code = '''html_unescape('<div>') -> \"<div>\"''', description = "Unescape tags" },
{ code = '''html_unescape('a & b') -> \"a & b\"''', description = "Unescape ampersand" },
{ code = '''html_unescape('"quoted"') -> \"\\\"quoted\\\"\"''', description = "Unescape quotes" },
{ code = "html_unescape(escaped) -> original", description = "Decode entities" },
]
features = ["core"]
[[functions]]
name = "all_expr"
category = "expression"
description = "Return true if every element satisfies the expression (short-circuits on false)"
signature = "array, expression -> boolean"
examples = [
{ code = "all_expr([1, 2, 3], &@ > `0`) -> true", description = "All positive" },
{ code = "all_expr([1, 2, 3], &@ > `2`) -> false", description = "Not all > 2" },
{ code = "all_expr([], &@ > `0`) -> true", description = "Empty array is true" },
{ code = "all_expr(users, &age >= `18`) -> true/false", description = "Check all adults" },
]
aliases = ["every"]
features = ["core", "fp"]
[[functions]]
name = "any_expr"
category = "expression"
description = "Return true if any element satisfies the expression (short-circuits)"
signature = "array, expression -> boolean"
examples = [
{ code = "any_expr([1, 2, 3], &@ > `2`) -> true", description = "At least one > 2" },
{ code = "any_expr([1, 2, 3], &@ > `5`) -> false", description = "None > 5" },
{ code = "any_expr([], &@ > `0`) -> false", description = "Empty array is false" },
{ code = "any_expr(users, &status == 'active') -> true/false", description = "Any active user" },
]
aliases = ["some"]
features = ["core", "fp"]
[[functions]]
name = "apply"
category = "expression"
description = "Apply a partial function or invoke a function by name with arguments"
signature = "object|string, ...any -> any"
examples = [
{ code = '''apply(partial('join', `\"-\"`), `[\"a\", \"b\"]`) -> 'a-b' ''', description = "Apply partial function" },
{ code = "apply('length', 'hello') -> 5", description = "Call function by name" },
{ code = "apply('add', `1`, `2`) -> 3", description = "Call with multiple args" },
{ code = "apply(partial('contains', 'hello'), 'ell') -> true", description = "Partial with contains" },
]
features = ["core"]
[[functions]]
name = "count_by"
category = "expression"
description = "Count occurrences grouped by expression result"
signature = "string, array -> object"
examples = [
{ code = "count_by('type', [{type: 'a'}, {type: 'b'}, {type: 'a'}]) -> {a: 2, b: 1}", description = "Count by field" },
{ code = "count_by('status', orders) -> {pending: 5, shipped: 3}", description = "Count orders by status" },
{ code = "count_by('@ > `50`', [30, 60, 70, 40]) -> {true: 2, false: 2}", description = "Count by condition" },
{ code = "count_by('category', []) -> {}", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "count_expr"
category = "expression"
description = "Count how many elements satisfy the expression"
signature = "array, expression -> number"
examples = [
{ code = "count_expr([1, 2, 3], &@ > `1`) -> 2", description = "Count > 1" },
{ code = "count_expr([1, 2, 3], &@ > `5`) -> 0", description = "None match" },
{ code = "count_expr(users, &active == `true`) -> 5", description = "Count active users" },
{ code = "count_expr([], &@ > `0`) -> 0", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "drop_while"
category = "expression"
description = "Drop elements from array while expression is truthy"
signature = "string, array -> array"
examples = [
{ code = "drop_while('@ < `4`', [1, 2, 3, 5, 1]) -> [5, 1]", description = "Drop while < 4" },
{ code = "drop_while('@ < `0`', [1, 2, 3]) -> [1, 2, 3]", description = "None dropped" },
{ code = "drop_while('@ < `10`', [1, 2, 3]) -> []", description = "All dropped" },
{ code = "drop_while('length(@) < `3`', ['a', 'ab', 'abc', 'x']) -> ['abc', 'x']", description = "Drop short strings" },
]
features = ["core", "fp"]
[[functions]]
name = "every"
category = "expression"
description = "Check if all elements match (alias for all_expr)"
signature = "string, array -> boolean"
examples = [
{ code = "every('@ > `0`', [1, 2, 3]) -> true", description = "All positive" },
{ code = "every('@ > `2`', [1, 2, 3]) -> false", description = "Not all > 2" },
{ code = "every('length(@) > `0`', ['a', 'b']) -> true", description = "All non-empty" },
{ code = "every('@ > `0`', []) -> true", description = "Empty is vacuously true" },
]
features = ["core", "fp"]
[[functions]]
name = "filter_expr"
category = "expression"
description = "Keep elements where JMESPath expression evaluates to truthy value"
signature = "array, expression -> array"
examples = [
{ code = "filter_expr([1, 2, 3], &@ > `1`) -> [2, 3]", description = "Filter numbers" },
{ code = "filter_expr(users, &age >= `18`) -> [adult users]", description = "Filter objects by field" },
{ code = "filter_expr(['a', '', 'b'], &length(@) > `0`) -> ['a', 'b']", description = "Filter empty strings" },
{ code = "filter_expr([], &@ > `0`) -> []", description = "Empty array returns empty" },
]
aliases = ["filter"]
features = ["core", "fp"]
[[functions]]
name = "find_expr"
category = "expression"
description = "Return first element where expression is truthy, or null if none match"
signature = "array, expression -> any"
examples = [
{ code = "find_expr([1, 2, 3], &@ > `1`) -> 2", description = "First > 1" },
{ code = "find_expr([1, 2, 3], &@ > `5`) -> null", description = "None found" },
{ code = "find_expr(users, &name == 'alice') -> {name: 'alice', ...}", description = "Find user" },
{ code = "find_expr([], &@ > `0`) -> null", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "find_index_expr"
category = "expression"
description = "Return zero-based index of first matching element, or -1 if none match"
signature = "array, expression -> number | null"
examples = [
{ code = "find_index_expr([1, 2, 3], &@ > `1`) -> 1", description = "Index of first > 1" },
{ code = "find_index_expr([1, 2, 3], &@ > `5`) -> -1", description = "Not found" },
{ code = "find_index_expr([5, 10, 15], &@ == `10`) -> 1", description = "Exact match" },
{ code = "find_index_expr([], &@ > `0`) -> -1", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "flat_map_expr"
category = "expression"
description = "Apply expression to each element and flatten all results into one array"
signature = "array, expression -> array"
examples = [
{ code = "flat_map_expr([[1], [2]], &@) -> [1, 2]", description = "Flatten nested arrays" },
{ code = "flat_map_expr([1, 2], &[@, @ * `2`]) -> [1, 2, 2, 4]", description = "Duplicate and transform" },
{ code = "flat_map_expr(users, &tags) -> all tags flattened", description = "Flatten object arrays" },
{ code = "flat_map_expr([], &@) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "group_by_expr"
category = "expression"
description = "Group elements into object keyed by expression result"
signature = "array, expression -> object"
examples = [
{ code = "group_by_expr([{t: 'a'}, {t: 'b'}], &t) -> {a: [...], b: [...]}", description = "Group by field" },
{ code = "group_by_expr([1, 2, 3, 4], &@ > `2`) -> {true: [3, 4], false: [1, 2]}", description = "Group by condition" },
{ code = "group_by_expr(users, &department) -> {eng: [...], sales: [...]}", description = "Group users" },
{ code = "group_by_expr([], &@) -> {}", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "map_expr"
category = "expression"
description = "Apply a JMESPath expression to each element, returning transformed array"
signature = "array, expression -> array"
examples = [
{ code = "map_expr([1, 2], &@ * `2`) -> [2, 4]", description = "Double each number" },
{ code = "map_expr(users, &name) -> ['alice', 'bob']", description = "Extract field from objects" },
{ code = "map_expr(['hello', 'world'], &upper(@)) -> ['HELLO', 'WORLD']", description = "Transform strings" },
{ code = "map_expr([], &@ * `2`) -> []", description = "Empty array returns empty" },
]
features = ["core"]
[[functions]]
name = "map_keys"
category = "expression"
description = "Transform object keys using expression"
signature = "string, object -> object"
examples = [
{ code = "map_keys('upper(@)', {a: 1}) -> {A: 1}", description = "Uppercase keys" },
{ code = "map_keys('lower(@)', {A: 1, B: 2}) -> {a: 1, b: 2}", description = "Lowercase keys" },
{ code = "map_keys('concat(@, `\"_suffix\"`)', {x: 1}) -> {x_suffix: 1}", description = "Add suffix" },
{ code = "map_keys('upper(@)', {}) -> {}", description = "Empty object" },
]
features = ["core", "fp"]
[[functions]]
name = "map_values"
category = "expression"
description = "Transform object values using expression"
signature = "string, object -> object"
examples = [
{ code = "map_values('@ * `2`', {a: 1, b: 2}) -> {a: 2, b: 4}", description = "Double values" },
{ code = "map_values('upper(@)', {a: 'x', b: 'y'}) -> {a: 'X', b: 'Y'}", description = "Uppercase strings" },
{ code = "map_values('@ + `10`', {x: 5}) -> {x: 15}", description = "Add to values" },
{ code = "map_values('@ * `2`', {}) -> {}", description = "Empty object" },
]
features = ["core", "fp"]
[[functions]]
name = "max_by_expr"
category = "expression"
description = "Return element with largest expression result, or null for empty array"
signature = "array, expression -> any"
examples = [
{ code = "max_by_expr([{a: 2}, {a: 1}], &a) -> {a: 2}", description = "Max by field" },
{ code = "max_by_expr(['a', 'abc', 'ab'], &length(@)) -> 'abc'", description = "Longest string" },
{ code = "max_by_expr(products, &price) -> most expensive", description = "Max price product" },
{ code = "max_by_expr([], &a) -> null", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "min_by_expr"
category = "expression"
description = "Return element with smallest expression result, or null for empty array"
signature = "array, expression -> any"
examples = [
{ code = "min_by_expr([{a: 2}, {a: 1}], &a) -> {a: 1}", description = "Min by field" },
{ code = "min_by_expr(['a', 'abc', 'ab'], &length(@)) -> 'a'", description = "Shortest string" },
{ code = "min_by_expr(products, &price) -> cheapest", description = "Min price product" },
{ code = "min_by_expr([], &a) -> null", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "order_by"
category = "expression"
description = "Sort array by multiple fields with ascending/descending control"
signature = "array, array[[string, string]] -> array"
examples = [
{ code = "order_by(items, [['name', 'asc'], ['price', 'desc']]) -> sorted", description = "Multi-field sort" },
{ code = "order_by(users, [['age', 'asc']]) -> youngest first", description = "Single field ascending" },
{ code = "order_by(products, [['price', 'desc']]) -> most expensive first", description = "Descending sort" },
{ code = "order_by([], [['a', 'asc']]) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "partial"
category = "expression"
description = "Create a partial function with some arguments pre-filled"
signature = "string, ...any -> object"
examples = [
{ code = '''partial('contains', `\"hello\"`) -> {__partial__: true, ...}''', description = "Partial contains" },
{ code = "partial('add', `10`) -> partial add 10", description = "Partial addition" },
{ code = "partial('join', '-') -> partial join with dash", description = "Partial join" },
{ code = "partial('multiply', `2`) -> partial multiply by 2", description = "Partial multiply" },
]
features = ["core"]
[[functions]]
name = "partition_expr"
category = "expression"
description = "Split array into [matches, non-matches] based on expression"
signature = "array, expression -> array"
examples = [
{ code = "partition_expr([1, 2, 3], &@ > `1`) -> [[2, 3], [1]]", description = "Split by condition" },
{ code = "partition_expr([1, 2, 3, 4], &@ % `2` == `0`) -> [[2, 4], [1, 3]]", description = "Even vs odd" },
{ code = "partition_expr(users, &active) -> [active, inactive]", description = "Partition users" },
{ code = "partition_expr([], &@ > `0`) -> [[], []]", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "reduce_expr"
category = "expression"
description = "Reduce array to single value using accumulator expression"
signature = "string, array, any -> any"
examples = [
{ code = "reduce_expr('add(accumulator, current)', [1, 2, 3], `0`) -> 6", description = "Sum numbers" },
{ code = "reduce_expr('multiply(accumulator, current)', [2, 3, 4], `1`) -> 24", description = "Product" },
{ code = "reduce_expr('max(accumulator, current)', [3, 1, 4], `0`) -> 4", description = "Find max" },
{ code = "reduce_expr('concat(accumulator, current)', ['a', 'b'], '') -> 'ab'", description = "Concat strings" },
]
aliases = ["fold"]
features = ["core", "fp"]
[[functions]]
name = "reject"
category = "expression"
description = "Keep elements where expression is falsy (inverse of filter_expr)"
signature = "string, array -> array"
examples = [
{ code = "reject('@ > `2`', [1, 2, 3, 4]) -> [1, 2]", description = "Reject > 2" },
{ code = "reject('@ < `0`', [1, -1, 2, -2]) -> [1, 2]", description = "Reject negatives" },
{ code = "reject('active', users) -> inactive users", description = "Reject active users" },
{ code = "reject('@ > `0`', []) -> []", description = "Empty array" },
]
features = ["core", "fp"]
[[functions]]
name = "scan_expr"
category = "expression"
description = "Like reduce but returns array of intermediate accumulator values"
signature = "string, array, any -> array"
examples = [
{ code = "scan_expr('add(accumulator, current)', [1, 2, 3], `0`) -> [1, 3, 6]", description = "Running sum" },
{ code = "scan_expr('multiply(accumulator, current)', [2, 3, 4], `1`) -> [2, 6, 24]", description = "Running product" },
{ code = "scan_expr('max(accumulator, current)', [3, 1, 4], `0`) -> [3, 3, 4]", description = "Running max" },
{ code = "scan_expr('add(accumulator, current)', [], `0`) -> []", description = "Empty array" },
]
features = ["core", "fp"]
[[functions]]
name = "some"
category = "expression"
description = "Check if any element matches (alias for any_expr)"
signature = "string, array -> boolean"
examples = [
{ code = "some('@ > `2`', [1, 2, 3]) -> true", description = "Some > 2" },
{ code = "some('@ > `5`', [1, 2, 3]) -> false", description = "None > 5" },
{ code = "some('active', users) -> true/false", description = "Any active user" },
{ code = "some('@ > `0`', []) -> false", description = "Empty is false" },
]
features = ["core", "fp"]
[[functions]]
name = "sort_by_expr"
category = "expression"
description = "Sort array by expression result in ascending order"
signature = "array, expression -> array"
examples = [
{ code = "sort_by_expr([{a: 2}, {a: 1}], &a) -> [{a: 1}, {a: 2}]", description = "Sort by field" },
{ code = "sort_by_expr(['bb', 'a', 'ccc'], &length(@)) -> ['a', 'bb', 'ccc']", description = "Sort by length" },
{ code = "sort_by_expr(users, &name) -> alphabetical", description = "Sort users by name" },
{ code = "sort_by_expr([], &a) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "take_while"
category = "expression"
description = "Take elements from array while expression is truthy"
signature = "string, array -> array"
examples = [
{ code = "take_while('@ < `4`', [1, 2, 3, 5, 1]) -> [1, 2, 3]", description = "Take while < 4" },
{ code = "take_while('@ > `0`', [3, 2, 1, 0, 5]) -> [3, 2, 1]", description = "Take while positive" },
{ code = "take_while('length(@) < `3`', ['a', 'ab', 'abc']) -> ['a', 'ab']", description = "Take short strings" },
{ code = "take_while('@ < `0`', [1, 2, 3]) -> []", description = "None taken" },
]
features = ["core", "fp"]
[[functions]]
name = "unique_by_expr"
category = "expression"
description = "Remove duplicates by expression result, keeping first occurrence"
signature = "array, expression -> array"
examples = [
{ code = "unique_by_expr([{a: 1}, {a: 1}], &a) -> [{a: 1}]", description = "Unique by field" },
{ code = "unique_by_expr([{id: 1, v: 'a'}, {id: 1, v: 'b'}], &id) -> [{id: 1, v: 'a'}]", description = "First wins" },
{ code = "unique_by_expr(['aa', 'b', 'cc'], &length(@)) -> ['aa', 'b']", description = "Unique by length" },
{ code = "unique_by_expr([], &a) -> []", description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "zip_with"
category = "expression"
description = "Zip two arrays with a custom combiner expression"
signature = "string, array, array -> array"
examples = [
{ code = "zip_with('add([0], [1])', [1, 2], [10, 20]) -> [11, 22]", description = "Add pairs" },
{ code = "zip_with('multiply([0], [1])', [2, 3], [4, 5]) -> [8, 15]", description = "Multiply pairs" },
{ code = "zip_with('concat([0], [1])', ['a', 'b'], ['1', '2']) -> ['a1', 'b2']", description = "Concat pairs" },
{ code = "zip_with('add([0], [1])', [], []) -> []", description = "Empty arrays" },
]
features = ["core", "fp"]
[[functions]]
name = "walk"
category = "expression"
description = "Recursively apply expression to all components of a value (bottom-up)"
signature = "string, any -> any"
examples = [
{ code = "walk('@', data) -> data unchanged", description = "Identity transform" },
{ code = "walk('type(@)', {a: 1}) -> 'object'", description = "Get type of result" },
{ code = "walk('length(@)', [[], []]) -> 2", description = "Lengths of nested arrays" },
{ code = "walk('keys(@)', {a: {b: 1}}) -> ['a']", description = "Keys at each level" },
]
features = ["core", "fp"]
[[functions]]
name = "damerau_levenshtein"
category = "fuzzy"
description = "Damerau-Levenshtein distance"
signature = "string, string -> number"
examples = [
{ code = "damerau_levenshtein('ab', 'ba') -> 1", description = "Single transposition" },
{ code = "damerau_levenshtein('hello', 'hello') -> 0", description = "Identical strings" },
{ code = "damerau_levenshtein('ca', 'abc') -> 2", description = "Multiple edits" },
]
features = ["core"]
[[functions]]
name = "jaro"
category = "fuzzy"
description = "Jaro similarity (0-1)"
signature = "string, string -> number"
examples = [
{ code = "jaro('hello', 'hallo') -> 0.866...", description = "Similar words" },
{ code = "jaro('hello', 'hello') -> 1.0", description = "Identical strings" },
{ code = "jaro('abc', 'xyz') -> 0.0", description = "Completely different" },
]
features = ["core"]
[[functions]]
name = "jaro_winkler"
category = "fuzzy"
description = "Jaro-Winkler similarity (0-1)"
signature = "string, string -> number"
examples = [
{ code = "jaro_winkler('hello', 'hallo') -> 0.88", description = "Similar words" },
{ code = "jaro_winkler('hello', 'hello') -> 1.0", description = "Identical strings" },
{ code = "jaro_winkler('abc', 'xyz') -> 0.0", description = "Completely different" },
]
features = ["core"]
[[functions]]
name = "levenshtein"
category = "fuzzy"
description = "Levenshtein edit distance"
signature = "string, string -> number"
examples = [
{ code = "levenshtein('kitten', 'sitting') -> 3", description = "Classic example" },
{ code = "levenshtein('hello', 'hello') -> 0", description = "Identical strings" },
{ code = "levenshtein('abc', 'def') -> 3", description = "All different" },
]
features = ["core"]
[[functions]]
name = "normalized_levenshtein"
category = "fuzzy"
description = "Normalized Levenshtein (0-1)"
signature = "string, string -> number"
examples = [
{ code = "normalized_levenshtein('ab', 'abc') -> 0.666...", description = "One edit" },
{ code = "normalized_levenshtein('hello', 'hello') -> 0.0", description = "Identical" },
{ code = "normalized_levenshtein('abc', 'xyz') -> 1.0", description = "All different" },
]
features = ["core"]
[[functions]]
name = "sorensen_dice"
category = "fuzzy"
description = "Sorensen-Dice coefficient (0-1)"
signature = "string, string -> number"
examples = [
{ code = "sorensen_dice('night', 'nacht') -> 0.25", description = "Similar words" },
{ code = "sorensen_dice('hello', 'hello') -> 1.0", description = "Identical strings" },
{ code = "sorensen_dice('abc', 'xyz') -> 0.0", description = "No common bigrams" },
]
features = ["core"]
[[functions]]
name = "geo_bearing"
category = "geo"
description = "Bearing between coordinates"
signature = "number, number, number, number -> number"
examples = [
{ code = "geo_bearing(`40.7128`, `-74.0060`, `51.5074`, `-0.1278`) -> 51.2", description = "NYC to London" },
{ code = "geo_bearing(`0`, `0`, `0`, `90`) -> 90.0", description = "Due east" },
{ code = "geo_bearing(`0`, `0`, `90`, `0`) -> 0.0", description = "Due north" },
]
features = ["core"]
[[functions]]
name = "geo_distance"
category = "geo"
description = "Haversine distance in meters"
signature = "number, number, number, number -> number"
examples = [
{ code = "geo_distance(`40.7128`, `-74.0060`, `51.5074`, `-0.1278`) -> 5570222", description = "NYC to London" },
{ code = "geo_distance(`34.0522`, `-118.2437`, `37.7749`, `-122.4194`) -> 559044", description = "LA to SF" },
{ code = "geo_distance(`0`, `0`, `0`, `0`) -> 0", description = "Same point" },
]
features = ["core"]
[[functions]]
name = "geo_distance_km"
category = "geo"
description = "Haversine distance in kilometers"
signature = "number, number, number, number -> number"
examples = [
{ code = "geo_distance_km(`40.7128`, `-74.0060`, `51.5074`, `-0.1278`) -> 5570.2", description = "NYC to London" },
{ code = "geo_distance_km(`34.0522`, `-118.2437`, `37.7749`, `-122.4194`) -> 559.0", description = "LA to SF" },
{ code = "geo_distance_km(`48.8566`, `2.3522`, `51.5074`, `-0.1278`) -> 343.5", description = "Paris to London" },
]
features = ["core"]
[[functions]]
name = "geo_distance_miles"
category = "geo"
description = "Haversine distance in miles"
signature = "number, number, number, number -> number"
examples = [
{ code = "geo_distance_miles(`40.7128`, `-74.0060`, `51.5074`, `-0.1278`) -> 3461.0", description = "NYC to London" },
{ code = "geo_distance_miles(`34.0522`, `-118.2437`, `37.7749`, `-122.4194`) -> 347.4", description = "LA to SF" },
{ code = "geo_distance_miles(`48.8566`, `2.3522`, `51.5074`, `-0.1278`) -> 213.4", description = "Paris to London" },
]
features = ["core"]
[[functions]]
name = "crc32"
category = "hash"
description = "Calculate CRC32 checksum"
signature = "string -> number"
examples = [
{ code = "crc32('hello') -> 907060870", description = "Simple string" },
{ code = "crc32('') -> 0", description = "Empty string" },
{ code = "crc32('test data') -> 2706273274", description = "Data with space" },
]
features = ["core"]
[[functions]]
name = "hmac_md5"
category = "hash"
description = "Calculate HMAC-MD5 signature"
signature = "string, string -> string"
examples = [
{ code = '''hmac_md5('hello', 'secret') -> \"e17e4e4a205c55782dce5b6ff41e6e19\"''', description = "With secret key" },
{ code = '''hmac_md5('message', 'key') -> \"a24c903c3a7e7b741ea77bd467b98bca\"''', description = "Different message" },
]
features = ["core"]
[[functions]]
name = "hmac_sha1"
category = "hash"
description = "Calculate HMAC-SHA1 signature"
signature = "string, string -> string"
examples = [
{ code = '''hmac_sha1('hello', 'secret') -> \"5112055c36b16a6693045d75a054332e4555b52f\"''', description = "With secret key" },
{ code = '''hmac_sha1('data', 'key') -> \"104152c5bfdca07bc633eebd46199f0255c9f49d\"''', description = "Different data" },
]
features = ["core"]
[[functions]]
name = "hmac_sha256"
category = "hash"
description = "Calculate HMAC-SHA256 signature"
signature = "string, string -> string"
examples = [
{ code = '''hmac_sha256('hello', 'secret') -> \"88aab3ede8d3adf94d26ab90d3bafd4a2083070c3bcce9c014ee04a443847c0b\"''', description = "With secret key" },
{ code = '''hmac_sha256('data', 'key') -> \"5031fe3d989c6d1537a013fa6e739da23463fdaec3b70137d828e36ace221bd0\"''', description = "Different data" },
]
features = ["core"]
[[functions]]
name = "hmac_sha512"
category = "hash"
description = "Calculate HMAC-SHA512 signature"
signature = "string, string -> string"
examples = [
{ code = '''hmac_sha512('hello', 'secret') -> \"d05888a20ae...\"''', description = "With secret key" },
{ code = '''hmac_sha512('data', 'key') -> \"3c5953a18...\"''', description = "Different data" },
]
features = ["core"]
[[functions]]
name = "md5"
category = "hash"
description = "Calculate MD5 hash"
signature = "string -> string"
examples = [
{ code = '''md5('hello') -> \"5d41402abc4b2a76b9719d911017c592\"''', description = "Simple string" },
{ code = '''md5('') -> \"d41d8cd98f00b204e9800998ecf8427e\"''', description = "Empty string" },
{ code = '''md5('test') -> \"098f6bcd4621d373cade4e832627b4f6\"''', description = "Another string" },
]
features = ["core"]
[[functions]]
name = "sha1"
category = "hash"
description = "Calculate SHA-1 hash"
signature = "string -> string"
examples = [
{ code = '''sha1('hello') -> \"aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d\"''', description = "Simple string" },
{ code = '''sha1('') -> \"da39a3ee5e6b4b0d3255bfef95601890afd80709\"''', description = "Empty string" },
{ code = '''sha1('test') -> \"a94a8fe5ccb19ba61c4c0873d391e987982fbbd3\"''', description = "Another string" },
]
features = ["core"]
[[functions]]
name = "sha256"
category = "hash"
description = "Calculate SHA-256 hash"
signature = "string -> string"
examples = [
{ code = '''sha256('hello') -> \"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824\"''', description = "Simple string" },
{ code = '''sha256('') -> \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"''', description = "Empty string" },
{ code = '''sha256('test') -> \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\"''', description = "Another string" },
]
features = ["core"]
[[functions]]
name = "sha512"
category = "hash"
description = "Calculate SHA-512 hash"
signature = "string -> string"
examples = [
{ code = '''sha512('hello') -> \"9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043\"''', description = "Simple string" },
{ code = '''sha512('test') -> \"ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff\"''', description = "Another string" },
]
features = ["core"]
[[functions]]
name = "nanoid"
category = "ids"
description = "Generate nanoid"
signature = "number? -> string"
examples = [
{ code = '''nanoid() -> \"V1StGXR8_Z5jdHi6B-myT\"''', description = "Default 21 chars" },
{ code = '''nanoid(`10`) -> \"IRFa-VaY2b\"''', description = "Custom length" },
]
features = ["core"]
[[functions]]
name = "ulid"
category = "ids"
description = "Generate ULID"
signature = "-> string"
examples = [
{ code = '''ulid() -> \"01ARZ3NDEKTSV4RRFFQ69G5FAV\"''', description = "Generate ULID" },
{ code = '''length(ulid()) -> 26''', description = "Always 26 chars" },
]
features = ["core"]
[[functions]]
name = "ulid_timestamp"
category = "ids"
description = "Extract timestamp from ULID"
signature = "string -> number"
examples = [
{ code = "ulid_timestamp('01ARZ3NDEKTSV4RRFFQ69G5FAV') -> 1469918176385", description = "Extract timestamp" },
{ code = "ulid_timestamp('01BX5ZZKBKACTAV9WEVGEMMVRY') -> 1484581420610", description = "Another ULID" },
]
features = ["core"]
[[functions]]
name = "json_diff"
category = "jsonpatch"
description = "Generate JSON Patch (RFC 6902) that transforms first object into second"
signature = "object, object -> array"
examples = [
{ code = "json_diff({a: 1}, {a: 2}) -> [{op: 'replace', path: '/a', value: 2}]", description = "Replace value" },
{ code = "json_diff({a: 1}, {a: 1, b: 2}) -> [{op: 'add', path: '/b', value: 2}]", description = "Add field" },
{ code = "json_diff({a: 1, b: 2}, {a: 1}) -> [{op: 'remove', path: '/b'}]", description = "Remove field" },
]
features = ["core"]
[[functions]]
name = "json_merge_patch"
category = "jsonpatch"
description = "Apply JSON Merge Patch (RFC 7396) to an object"
signature = "object, object -> object"
examples = [
{ code = "json_merge_patch({a: 1, b: 2}, {b: 3, c: 4}) -> {a: 1, b: 3, c: 4}", description = "Merge objects" },
{ code = "json_merge_patch({a: 1}, {a: `null`}) -> {}", description = "Null removes field" },
{ code = "json_merge_patch({}, {a: 1}) -> {a: 1}", description = "Add to empty" },
]
features = ["core"]
[[functions]]
name = "json_patch"
category = "jsonpatch"
description = "Apply JSON Patch (RFC 6902) operations to an object"
signature = "object, array -> object"
examples = [
{ code = "json_patch({a: 1}, [{op: 'add', path: '/b', value: 2}]) -> {a: 1, b: 2}", description = "Add operation" },
{ code = "json_patch({a: 1}, [{op: 'replace', path: '/a', value: 2}]) -> {a: 2}", description = "Replace operation" },
{ code = "json_patch({a: 1, b: 2}, [{op: 'remove', path: '/b'}]) -> {a: 1}", description = "Remove operation" },
]
features = ["core"]
[[functions]]
name = "abs_fn"
category = "math"
description = "Absolute value"
signature = "number -> number"
examples = [
{ code = "abs_fn(`-5`) -> 5", description = "Negative to positive" },
{ code = "abs_fn(`5`) -> 5", description = "Already positive" },
{ code = "abs_fn(`0`) -> 0", description = "Zero stays zero" },
{ code = "abs_fn(`-3.14`) -> 3.14", description = "Negative float" },
]
features = ["core"]
[[functions]]
name = "add"
category = "math"
description = "Add two numbers"
signature = "number, number -> number"
examples = [
{ code = "add(`2`, `3`) -> 5", description = "Add integers" },
{ code = "add(`1.5`, `2.5`) -> 4.0", description = "Add floats" },
{ code = "add(`-5`, `3`) -> -2", description = "With negative" },
{ code = "add(`0`, `10`) -> 10", description = "Add zero" },
]
features = ["core"]
[[functions]]
name = "ceil_fn"
category = "math"
description = "Round up to nearest integer"
signature = "number -> number"
examples = [
{ code = "ceil_fn(`3.2`) -> 4", description = "Round up fraction" },
{ code = "ceil_fn(`3.9`) -> 4", description = "Round up high fraction" },
{ code = "ceil_fn(`3.0`) -> 3", description = "Already integer" },
{ code = "ceil_fn(`-3.2`) -> -3", description = "Negative rounds toward zero" },
]
features = ["core"]
[[functions]]
name = "clamp"
category = "math"
description = "Clamp value to range"
signature = "number, number, number -> number"
examples = [
{ code = "clamp(`15`, `0`, `10`) -> 10", description = "Above max" },
{ code = "clamp(`-5`, `0`, `10`) -> 0", description = "Below min" },
{ code = "clamp(`5`, `0`, `10`) -> 5", description = "Within range" },
{ code = "clamp(`100`, `50`, `75`) -> 75", description = "Custom range" },
]
features = ["core"]
[[functions]]
name = "cos"
category = "math"
description = "Cosine function"
signature = "number -> number"
examples = [
{ code = "cos(`0`) -> 1", description = "Cos of 0" },
{ code = "cos(`3.14159`) -> -1", description = "Cos of pi" },
{ code = "cos(`1.5708`) -> ~0", description = "Cos of pi/2" },
{ code = "cos(`6.28318`) -> 1", description = "Cos of 2*pi" },
]
features = ["core"]
[[functions]]
name = "covariance"
category = "math"
description = "Covariance between two arrays"
signature = "array, array -> number"
examples = [
{ code = "covariance([1, 2, 3], [1, 2, 3]) -> 0.666...", description = "Perfect positive" },
{ code = "covariance([1, 2, 3], [3, 2, 1]) -> -0.666...", description = "Perfect negative" },
{ code = "covariance([1, 2, 3], [1, 1, 1]) -> 0", description = "No correlation" },
{ code = "covariance(x_values, y_values) -> number", description = "From arrays" },
]
features = ["core"]
[[functions]]
name = "divide"
category = "math"
description = "Divide first number by second"
signature = "number, number -> number"
examples = [
{ code = "divide(`10`, `2`) -> 5", description = "Integer division" },
{ code = "divide(`7`, `2`) -> 3.5", description = "Fractional result" },
{ code = "divide(`1`, `3`) -> 0.333...", description = "Repeating decimal" },
{ code = "divide(`-10`, `2`) -> -5", description = "Negative dividend" },
]
features = ["core"]
[[functions]]
name = "ewma"
category = "math"
description = "Exponential weighted moving average"
signature = "array, number -> array"
examples = [
{ code = "ewma([1, 2, 3, 4, 5], `0.5`) -> [1, 1.5, 2.25, ...]", description = "Alpha 0.5" },
{ code = "ewma(prices, `0.3`) -> smoothed prices", description = "Smooth stock prices" },
{ code = "ewma([10, 20, 30], `0.9`) -> fast response", description = "High alpha" },
{ code = "ewma([10, 20, 30], `0.1`) -> slow response", description = "Low alpha" },
]
features = ["core"]
[[functions]]
name = "floor_fn"
category = "math"
description = "Round down to nearest integer"
signature = "number -> number"
examples = [
{ code = "floor_fn(`3.7`) -> 3", description = "Round down high fraction" },
{ code = "floor_fn(`3.2`) -> 3", description = "Round down low fraction" },
{ code = "floor_fn(`3.0`) -> 3", description = "Already integer" },
{ code = "floor_fn(`-3.2`) -> -4", description = "Negative rounds away from zero" },
]
features = ["core"]
[[functions]]
name = "format_number"
category = "math"
description = "Format number with separators and optional suffix"
signature = "number, number?, string? -> string"
examples = [
{ code = '''format_number(`1234567`, `0`) -> \"1,234,567\"''', description = "With commas" },
{ code = '''format_number(`1234.56`, `2`) -> \"1,234.56\"''', description = "With decimals" },
{ code = '''format_number(`1000000`, `0`) -> \"1,000,000\"''', description = "Million" },
{ code = '''format_number(`99.9`, `1`) -> \"99.9\"''', description = "Small number" },
]
features = ["core"]
[[functions]]
name = "log"
category = "math"
description = "Natural logarithm"
signature = "number -> number"
examples = [
{ code = "log(`2.718`) -> ~1", description = "Log of e" },
{ code = "log(`1`) -> 0", description = "Log of 1" },
{ code = "log(`10`) -> 2.302...", description = "Log of 10" },
{ code = "log(`100`) -> 4.605...", description = "Log of 100" },
]
features = ["core"]
[[functions]]
name = "median"
category = "math"
description = "Calculate median of array"
signature = "array -> number"
examples = [
{ code = "median([1, 2, 3, 4, 5]) -> 3", description = "Odd count" },
{ code = "median([1, 2, 3, 4]) -> 2.5", description = "Even count" },
{ code = "median([10, 20, 30]) -> 20", description = "Middle value" },
{ code = "median([5]) -> 5", description = "Single element" },
]
features = ["core"]
[[functions]]
name = "mod_fn"
category = "math"
description = "Modulo operation"
signature = "number, number -> number"
examples = [
{ code = "mod_fn(`10`, `3`) -> 1", description = "Remainder of 10/3" },
{ code = "mod_fn(`15`, `5`) -> 0", description = "Evenly divisible" },
{ code = "mod_fn(`7`, `2`) -> 1", description = "Odd check" },
{ code = "mod_fn(`100`, `7`) -> 2", description = "Larger numbers" },
]
features = ["core"]
[[functions]]
name = "mode"
category = "math"
description = "Find the most common value in an array"
signature = "array -> any"
examples = [
{ code = "mode([1, 2, 2, 3]) -> 2", description = "Most frequent" },
{ code = "mode(['a', 'b', 'a', 'a']) -> 'a'", description = "String mode" },
{ code = "mode([1, 1, 2, 2, 3]) -> 1 or 2", description = "Tie returns first" },
{ code = "mode([5]) -> 5", description = "Single element" },
]
features = ["core"]
[[functions]]
name = "moving_avg"
category = "math"
description = "Simple moving average with window size"
signature = "array, number -> array"
examples = [
{ code = "moving_avg([1, 2, 3, 4, 5], `3`) -> [null, null, 2, 3, 4]", description = "Window of 3" },
{ code = "moving_avg([10, 20, 30, 40], `2`) -> [null, 15, 25, 35]", description = "Window of 2" },
{ code = "moving_avg(prices, `7`) -> weekly average", description = "7-day moving avg" },
{ code = "moving_avg([1, 2, 3], `1`) -> [1, 2, 3]", description = "Window of 1" },
]
features = ["core"]
[[functions]]
name = "multiply"
category = "math"
description = "Multiply two numbers"
signature = "number, number -> number"
examples = [
{ code = "multiply(`4`, `3`) -> 12", description = "Basic multiplication" },
{ code = "multiply(`2.5`, `4`) -> 10", description = "With decimals" },
{ code = "multiply(`-3`, `4`) -> -12", description = "With negative" },
{ code = "multiply(`0`, `100`) -> 0", description = "Multiply by zero" },
]
features = ["core"]
[[functions]]
name = "percentile"
category = "math"
description = "Calculate percentile of array"
signature = "array, number -> number"
examples = [
{ code = "percentile([1, 2, 3, 4, 5], `50`) -> 3", description = "50th percentile (median)" },
{ code = "percentile([1, 2, 3, 4, 5], `25`) -> 2", description = "25th percentile" },
{ code = "percentile([1, 2, 3, 4, 5], `75`) -> 4", description = "75th percentile" },
{ code = "percentile(scores, `90`) -> top 10% threshold", description = "90th percentile" },
]
features = ["core"]
[[functions]]
name = "pow"
category = "math"
description = "Raise to power"
signature = "number, number -> number"
examples = [
{ code = "pow(`2`, `3`) -> 8", description = "2 cubed" },
{ code = "pow(`10`, `2`) -> 100", description = "10 squared" },
{ code = "pow(`2`, `10`) -> 1024", description = "2^10" },
{ code = "pow(`4`, `0.5`) -> 2", description = "Square root via power" },
]
features = ["core"]
[[functions]]
name = "quantile"
category = "math"
description = "Nth quantile (generalized percentile, q in [0,1])"
signature = "array, number -> number"
examples = [
{ code = "quantile([1, 2, 3, 4, 5], `0.5`) -> 3", description = "Median (0.5)" },
{ code = "quantile([1, 2, 3, 4, 5], `0.25`) -> 2", description = "First quartile" },
{ code = "quantile([1, 2, 3, 4, 5], `0.75`) -> 4", description = "Third quartile" },
{ code = "quantile(values, `0.9`) -> 90th quantile", description = "90th quantile" },
]
features = ["core"]
[[functions]]
name = "round"
category = "math"
description = "Round to specified decimal places"
signature = "number, number -> number"
examples = [
{ code = "round(`3.14159`, `2`) -> 3.14", description = "Two decimals" },
{ code = "round(`3.5`, `0`) -> 4", description = "Round to integer" },
{ code = "round(`2.555`, `2`) -> 2.56", description = "Round up" },
{ code = "round(`123.456`, `1`) -> 123.5", description = "One decimal" },
]
features = ["core"]
[[functions]]
name = "sin"
category = "math"
description = "Sine function"
signature = "number -> number"
examples = [
{ code = "sin(`0`) -> 0", description = "Sin of 0" },
{ code = "sin(`1.5708`) -> 1", description = "Sin of pi/2" },
{ code = "sin(`3.14159`) -> ~0", description = "Sin of pi" },
{ code = "sin(`6.28318`) -> ~0", description = "Sin of 2*pi" },
]
features = ["core"]
[[functions]]
name = "sqrt"
category = "math"
description = "Square root"
signature = "number -> number"
examples = [
{ code = "sqrt(`16`) -> 4", description = "Perfect square" },
{ code = "sqrt(`2`) -> 1.414...", description = "Irrational result" },
{ code = "sqrt(`100`) -> 10", description = "Larger number" },
{ code = "sqrt(`0`) -> 0", description = "Zero" },
]
features = ["core"]
[[functions]]
name = "standardize"
category = "math"
description = "Standardize array to mean=0, std=1 (z-score normalization)"
signature = "array -> array"
examples = [
{ code = "standardize([10, 20, 30]) -> [-1.22, 0, 1.22]", description = "Basic z-scores" },
{ code = "standardize([1, 2, 3, 4, 5]) -> normalized", description = "Normalize values" },
{ code = "standardize(scores) -> z-scores", description = "Standardize scores" },
{ code = "standardize([5, 5, 5]) -> [0, 0, 0]", description = "Identical values" },
]
features = ["core"]
[[functions]]
name = "stddev"
category = "math"
description = "Calculate standard deviation of array"
signature = "array -> number"
examples = [
{ code = "stddev([1, 2, 3, 4, 5]) -> 1.414...", description = "Basic stddev" },
{ code = "stddev([10, 10, 10]) -> 0", description = "No variation" },
{ code = "stddev([1, 100]) -> ~49.5", description = "High variation" },
{ code = "stddev(values) -> spread measure", description = "Measure spread" },
]
features = ["core"]
[[functions]]
name = "subtract"
category = "math"
description = "Subtract second number from first"
signature = "number, number -> number"
examples = [
{ code = "subtract(`5`, `3`) -> 2", description = "Basic subtraction" },
{ code = "subtract(`10`, `15`) -> -5", description = "Negative result" },
{ code = "subtract(`3.5`, `1.5`) -> 2", description = "With decimals" },
{ code = "subtract(`0`, `5`) -> -5", description = "From zero" },
]
features = ["core"]
[[functions]]
name = "tan"
category = "math"
description = "Tangent function"
signature = "number -> number"
examples = [
{ code = "tan(`0`) -> 0", description = "Tan of 0" },
{ code = "tan(`0.7854`) -> ~1", description = "Tan of pi/4" },
{ code = "tan(`3.14159`) -> ~0", description = "Tan of pi" },
{ code = "tan(angle) -> ratio", description = "Calculate tangent" },
]
features = ["core"]
[[functions]]
name = "to_fixed"
category = "math"
description = "Format number with exact decimal places"
signature = "number, number -> string"
examples = [
{ code = '''to_fixed(`3.14159`, `2`) -> \"3.14\"''', description = "Two decimals" },
{ code = '''to_fixed(`5`, `2`) -> \"5.00\"''', description = "Pad with zeros" },
{ code = '''to_fixed(`99.9`, `0`) -> \"100\"''', description = "Round to integer" },
{ code = '''to_fixed(`1.5`, `3`) -> \"1.500\"''', description = "Extra precision" },
]
features = ["core"]
[[functions]]
name = "variance"
category = "math"
description = "Calculate variance of array"
signature = "array -> number"
examples = [
{ code = "variance([1, 2, 3, 4, 5]) -> 2", description = "Basic variance" },
{ code = "variance([10, 10, 10]) -> 0", description = "No variation" },
{ code = "variance([1, 100]) -> 2450.25", description = "High variation" },
{ code = "variance(values) -> spread^2", description = "Squared spread" },
]
features = ["core"]
[[functions]]
name = "extract_all"
category = "multimatch"
description = "Extract all pattern matches with positions (Aho-Corasick)"
signature = "string, array[string] -> array[object]"
examples = [
{ code = "extract_all('error warning', ['error', 'warning']) -> [{pattern: 'error', match: 'error', start: 0, end: 5}, ...]", description = "Multiple patterns" },
{ code = "extract_all('abab', ['a', 'b']) -> [{pattern: 'a', match: 'a', start: 0, end: 1}, ...]", description = "Overlapping matches" },
]
features = ["core"]
[[functions]]
name = "extract_between"
category = "multimatch"
description = "Extract text between two delimiters"
signature = "string, string, string -> string|null"
examples = [
{ code = '''extract_between('<title>Page</title>', '<title>', '</title>') -> \"Page\"''', description = "HTML tag content" },
{ code = '''extract_between('Hello [world]!', '[', ']') -> \"world\"''', description = "Bracketed content" },
{ code = "extract_between('no match', '[', ']') -> null", description = "No delimiters found" },
]
features = ["core"]
[[functions]]
name = "match_all"
category = "multimatch"
description = "Check if string contains all of the patterns (Aho-Corasick)"
signature = "string, array[string] -> boolean"
examples = [
{ code = "match_all('hello world', ['hello', 'world']) -> true", description = "All patterns found" },
{ code = "match_all('hello world', ['hello', 'foo']) -> false", description = "Missing pattern" },
{ code = "match_all('abc', []) -> true", description = "Empty patterns" },
]
features = ["core"]
[[functions]]
name = "match_any"
category = "multimatch"
description = "Check if string contains any of the patterns (Aho-Corasick)"
signature = "string, array[string] -> boolean"
examples = [
{ code = "match_any('hello world', ['world', 'foo']) -> true", description = "One pattern found" },
{ code = "match_any('hello world', ['foo', 'bar']) -> false", description = "No patterns found" },
{ code = "match_any('abc', []) -> false", description = "Empty patterns" },
]
features = ["core"]
[[functions]]
name = "match_count"
category = "multimatch"
description = "Count total pattern matches in string (Aho-Corasick)"
signature = "string, array[string] -> number"
examples = [
{ code = "match_count('abcabc', ['a', 'b']) -> 4", description = "Count all matches" },
{ code = "match_count('hello', ['l']) -> 2", description = "Repeated pattern" },
{ code = "match_count('abc', ['x']) -> 0", description = "No matches" },
]
features = ["core"]
[[functions]]
name = "match_positions"
category = "multimatch"
description = "Get start/end positions of all pattern matches (Aho-Corasick)"
signature = "string, array[string] -> array[object]"
examples = [
{ code = "match_positions('The quick fox', ['quick', 'fox']) -> [{pattern: 'quick', start: 4, end: 9}, ...]", description = "Find positions" },
{ code = "match_positions('abab', ['ab']) -> [{pattern: 'ab', start: 0, end: 2}, {pattern: 'ab', start: 2, end: 4}]", description = "Multiple occurrences" },
]
features = ["core"]
[[functions]]
name = "match_which"
category = "multimatch"
description = "Return array of patterns that match the string (Aho-Corasick)"
signature = "string, array[string] -> array[string]"
examples = [
{ code = '''match_which('hello world', ['hello', 'foo', 'world']) -> [\"hello\", \"world\"]''', description = "Find matching patterns" },
{ code = '''match_which('abc', ['a', 'b', 'x']) -> [\"a\", \"b\"]''', description = "Partial matches" },
{ code = "match_which('abc', ['x', 'y']) -> []", description = "No matches" },
]
features = ["core"]
[[functions]]
name = "replace_many"
category = "multimatch"
description = "Replace multiple patterns simultaneously (Aho-Corasick)"
signature = "string, object -> string"
examples = [
{ code = '''replace_many('hello world', {hello: 'hi', world: 'earth'}) -> \"hi earth\"''', description = "Multiple replacements" },
{ code = '''replace_many('aaa', {a: 'b'}) -> \"bbb\"''', description = "Repeated pattern" },
{ code = '''replace_many('abc', {x: 'y'}) -> \"abc\"''', description = "No matches" },
]
features = ["core"]
[[functions]]
name = "split_keep"
category = "multimatch"
description = "Split string keeping delimiters in result"
signature = "string, string -> array[string]"
examples = [
{ code = '''split_keep('a-b-c', '-') -> [\"a\", \"-\", \"b\", \"-\", \"c\"]''', description = "Keep dashes" },
{ code = '''split_keep('hello world', ' ') -> [\"hello\", \" \", \"world\"]''', description = "Keep spaces" },
{ code = '''split_keep('abc', '-') -> [\"abc\"]''', description = "No delimiter" },
]
features = ["core"]
[[functions]]
name = "tokenize"
category = "multimatch"
description = "Smart word tokenization with optional lowercase and min_length"
signature = "string, object? -> array[string]"
examples = [
{ code = '''tokenize('Hello, World!') -> [\"Hello\", \"World\"]''', description = "Basic tokenization" },
{ code = '''tokenize('Hello, World!', {lowercase: `true`}) -> [\"hello\", \"world\"]''', description = "Lowercase option" },
{ code = '''tokenize('a bb ccc', {min_length: `2`}) -> [\"bb\", \"ccc\"]''', description = "Minimum length" },
]
features = ["core"]
[[functions]]
name = "cidr_broadcast"
category = "network"
description = "Get broadcast address from CIDR"
signature = "string -> string"
examples = [
{ code = '''cidr_broadcast('192.168.1.0/24') -> \"192.168.1.255\"''', description = "/24 network" },
{ code = '''cidr_broadcast('10.0.0.0/8') -> \"10.255.255.255\"''', description = "/8 network" },
{ code = '''cidr_broadcast('172.16.0.0/16') -> \"172.16.255.255\"''', description = "/16 network" },
]
features = ["core"]
[[functions]]
name = "cidr_contains"
category = "network"
description = "Check if IP is in CIDR range"
signature = "string, string -> boolean"
examples = [
{ code = "cidr_contains('192.168.0.0/16', '192.168.1.1') -> true", description = "IP in range" },
{ code = "cidr_contains('10.0.0.0/8', '192.168.1.1') -> false", description = "IP not in range" },
{ code = "cidr_contains('0.0.0.0/0', '8.8.8.8') -> true", description = "Catch-all range" },
]
features = ["core"]
[[functions]]
name = "cidr_network"
category = "network"
description = "Get network address from CIDR"
signature = "string -> string"
examples = [
{ code = '''cidr_network('192.168.1.0/24') -> \"192.168.1.0\"''', description = "/24 network" },
{ code = '''cidr_network('10.0.0.0/8') -> \"10.0.0.0\"''', description = "/8 network" },
{ code = '''cidr_network('192.168.1.100/24') -> \"192.168.1.0\"''', description = "Host in network" },
]
features = ["core"]
[[functions]]
name = "cidr_prefix"
category = "network"
description = "Get prefix length from CIDR"
signature = "string -> number"
examples = [
{ code = "cidr_prefix('192.168.1.0/24') -> 24", description = "/24 prefix" },
{ code = "cidr_prefix('10.0.0.0/8') -> 8", description = "/8 prefix" },
{ code = "cidr_prefix('0.0.0.0/0') -> 0", description = "Default route" },
]
features = ["core"]
[[functions]]
name = "int_to_ip"
category = "network"
description = "Convert integer to IP address"
signature = "number -> string"
examples = [
{ code = '''int_to_ip(`3232235777`) -> \"192.168.1.1\"''', description = "Private IP" },
{ code = '''int_to_ip(`0`) -> \"0.0.0.0\"''', description = "Zero" },
{ code = '''int_to_ip(`4294967295`) -> \"255.255.255.255\"''', description = "Max value" },
]
features = ["core"]
[[functions]]
name = "ip_to_int"
category = "network"
description = "Convert IP address to integer"
signature = "string -> number"
examples = [
{ code = "ip_to_int('192.168.1.1') -> 3232235777", description = "Private IP" },
{ code = "ip_to_int('0.0.0.0') -> 0", description = "Zero" },
{ code = "ip_to_int('255.255.255.255') -> 4294967295", description = "Max value" },
]
features = ["core"]
[[functions]]
name = "is_private_ip"
category = "network"
description = "Check if IP is in private range"
signature = "string -> boolean"
examples = [
{ code = "is_private_ip('192.168.1.1') -> true", description = "Class C private" },
{ code = "is_private_ip('10.0.0.1') -> true", description = "Class A private" },
{ code = "is_private_ip('8.8.8.8') -> false", description = "Public IP" },
]
features = ["core"]
[[functions]]
name = "deep_diff"
category = "object"
description = "Structural diff between two objects"
signature = "object, object -> object"
examples = [
{ code = "deep_diff({a: 1}, {a: 2}) -> {added: {}, removed: {}, changed: {a: {from: 1, to: 2}}}", description = "Changed value" },
{ code = "deep_diff({a: 1}, {b: 2}) -> {added: {b: 2}, removed: {a: 1}, changed: {}}", description = "Added and removed" },
{ code = "deep_diff({a: 1}, {a: 1}) -> {added: {}, removed: {}, changed: {}}", description = "No differences" },
{ code = "deep_diff({}, {a: 1}) -> {added: {a: 1}, removed: {}, changed: {}}", description = "New key added" },
]
features = ["core"]
[[functions]]
name = "deep_equals"
category = "object"
description = "Deep equality check for any two values"
signature = "any, any -> boolean"
examples = [
{ code = "deep_equals({a: {b: 1}}, {a: {b: 1}}) -> true", description = "Equal nested objects" },
{ code = "deep_equals({a: 1}, {a: 2}) -> false", description = "Different values" },
{ code = "deep_equals([1, 2], [1, 2]) -> true", description = "Equal arrays" },
{ code = "deep_equals([1, 2], [2, 1]) -> false", description = "Order matters" },
]
features = ["core"]
[[functions]]
name = "deep_merge"
category = "object"
description = "Recursively merge objects"
signature = "object, object -> object"
examples = [
{ code = "deep_merge({a: {b: 1}}, {a: {c: 2}}) -> {a: {b: 1, c: 2}}", description = "Merge nested objects" },
{ code = "deep_merge({a: 1}, {b: 2}) -> {a: 1, b: 2}", description = "Merge flat objects" },
{ code = "deep_merge({a: 1}, {a: 2}) -> {a: 2}", description = "Later values override" },
{ code = "deep_merge({}, {a: 1}) -> {a: 1}", description = "Merge with empty object" },
]
features = ["core"]
[[functions]]
name = "defaults"
category = "object"
description = "Assign default values for missing keys (shallow)"
signature = "object, object -> object"
examples = [
{ code = "defaults({a: 1}, {a: 2, b: 3}) -> {a: 1, b: 3}", description = "Keep existing, add missing" },
{ code = "defaults({}, {a: 1, b: 2}) -> {a: 1, b: 2}", description = "All defaults applied" },
{ code = "defaults({a: 1, b: 2}, {}) -> {a: 1, b: 2}", description = "No defaults needed" },
{ code = "defaults({x: 1}, {y: 2}) -> {x: 1, y: 2}", description = "Different keys" },
]
features = ["core"]
[[functions]]
name = "defaults_deep"
category = "object"
description = "Recursively assign default values for missing keys"
signature = "object, object -> object"
examples = [
{ code = "defaults_deep({a: {b: 1}}, {a: {c: 2}}) -> {a: {b: 1, c: 2}}", description = "Merge nested defaults" },
{ code = "defaults_deep({a: {b: 1}}, {a: {b: 2}}) -> {a: {b: 1}}", description = "Keep existing nested" },
{ code = "defaults_deep({}, {a: {b: 1}}) -> {a: {b: 1}}", description = "Apply all nested defaults" },
{ code = "defaults_deep({x: 1}, {y: {z: 2}}) -> {x: 1, y: {z: 2}}", description = "Different structure" },
]
features = ["core"]
[[functions]]
name = "delete_path"
category = "object"
description = "Delete value at JSON pointer path (immutable)"
signature = "any, string -> any"
examples = [
{ code = "delete_path({a: 1, b: 2}, '/b') -> {a: 1}", description = "Delete top-level key" },
{ code = "delete_path({a: {b: 1, c: 2}}, '/a/b') -> {a: {c: 2}}", description = "Delete nested key" },
{ code = "delete_path([1, 2, 3], '/1') -> [1, 3]", description = "Delete array element" },
{ code = "delete_path({a: 1}, '/x') -> {a: 1}", description = "Path not found" },
]
features = ["core"]
[[functions]]
name = "flatten_keys"
category = "object"
description = "Flatten nested object with dot notation keys"
signature = "object -> object"
examples = [
{ code = '''flatten_keys({a: {b: 1}}) -> {\"a.b\": 1}''', description = "Simple nested" },
{ code = '''flatten_keys({a: {b: {c: 1}}}) -> {\"a.b.c\": 1}''', description = "Deep nested" },
{ code = '''flatten_keys({a: 1, b: 2}) -> {\"a\": 1, \"b\": 2}''', description = "Flat object" },
{ code = '''flatten_keys({x: {y: 1}, z: 2}) -> {\"x.y\": 1, \"z\": 2}''', description = "Mixed nesting" },
]
features = ["core"]
[[functions]]
name = "from_items"
category = "object"
description = "Convert array of [key, value] pairs to object"
signature = "array -> object"
examples = [
{ code = "from_items([['a', 1]]) -> {a: 1}", description = "Single pair" },
{ code = "from_items([['a', 1], ['b', 2]]) -> {a: 1, b: 2}", description = "Multiple pairs" },
{ code = "from_items([]) -> {}", description = "Empty array" },
{ code = "from_items([['x', 'hello']]) -> {x: 'hello'}", description = "String value" },
]
jep = "JEP-013"
features = ["core", "jep"]
[[functions]]
name = "get"
category = "object"
description = "Get value at dot-separated path with optional default"
signature = "any, string, any? -> any"
examples = [
{ code = "get({a: {b: 1}}, 'a.b') -> 1", description = "Nested path" },
{ code = "get({a: 1}, 'a') -> 1", description = "Top-level key" },
{ code = "get({a: 1}, 'x', 'default') -> 'default'", description = "Missing with default" },
{ code = "get({a: {b: {c: 3}}}, 'a.b.c') -> 3", description = "Deep path" },
]
features = ["core"]
[[functions]]
name = "has"
category = "object"
description = "Check if dot-separated path exists"
signature = "any, string -> boolean"
examples = [
{ code = "has({a: {b: 1}}, 'a.b') -> true", description = "Nested path exists" },
{ code = "has({a: 1}, 'a') -> true", description = "Top-level exists" },
{ code = "has({a: 1}, 'b') -> false", description = "Key missing" },
{ code = "has({a: {b: 1}}, 'a.c') -> false", description = "Nested missing" },
]
features = ["core"]
[[functions]]
name = "invert"
category = "object"
description = "Swap keys and values"
signature = "object -> object"
examples = [
{ code = "invert({a: 'x'}) -> {x: 'a'}", description = "Swap key and value" },
{ code = "invert({a: 'b', c: 'd'}) -> {b: 'a', d: 'c'}", description = "Multiple pairs" },
{ code = "invert({}) -> {}", description = "Empty object" },
{ code = "invert({name: 'id', value: 'data'}) -> {id: 'name', data: 'value'}", description = "Real-world example" },
]
features = ["core"]
[[functions]]
name = "items"
category = "object"
description = "Convert object to array of [key, value] pairs"
signature = "object -> array"
examples = [
{ code = '''items({a: 1}) -> [[\"a\", 1]]''', description = "Single key" },
{ code = '''items({a: 1, b: 2}) -> [[\"a\", 1], [\"b\", 2]]''', description = "Multiple keys" },
{ code = '''items({}) -> []''', description = "Empty object" },
{ code = '''items({x: 'hello'}) -> [[\"x\", \"hello\"]]''', description = "String value" },
]
jep = "JEP-013"
features = ["core", "jep"]
[[functions]]
name = "leaves"
category = "object"
description = "Get all leaf values (non-object, non-array)"
signature = "any -> array"
examples = [
{ code = "leaves({a: 1, b: [2, 3]}) -> [1, 2, 3]", description = "Mixed structure" },
{ code = "leaves({a: {b: 1}}) -> [1]", description = "Nested object" },
{ code = "leaves([1, 2, 3]) -> [1, 2, 3]", description = "Flat array" },
{ code = "leaves({a: 1, b: 2}) -> [1, 2]", description = "Flat object" },
]
features = ["core"]
[[functions]]
name = "leaves_with_paths"
category = "object"
description = "Get all leaf values with their JSON pointer paths"
signature = "any -> array"
examples = [
{ code = '''leaves_with_paths({a: 1}) -> [{path: \"/a\", value: 1}]''', description = "Single leaf" },
{ code = '''leaves_with_paths({a: {b: 1}}) -> [{path: \"/a/b\", value: 1}]''', description = "Nested path" },
{ code = '''leaves_with_paths([1, 2]) -> [{path: \"/0\", value: 1}, {path: \"/1\", value: 2}]''', description = "Array indices" },
{ code = '''leaves_with_paths({}) -> []''', description = "Empty object" },
]
features = ["core"]
[[functions]]
name = "omit"
category = "object"
description = "Remove specific keys from object"
signature = "object, array -> object"
examples = [
{ code = "omit({a: 1, b: 2}, ['a']) -> {b: 2}", description = "Remove one key" },
{ code = "omit({a: 1, b: 2, c: 3}, ['a', 'c']) -> {b: 2}", description = "Remove multiple keys" },
{ code = "omit({a: 1}, ['x']) -> {a: 1}", description = "Key not present" },
{ code = "omit({a: 1, b: 2}, []) -> {a: 1, b: 2}", description = "Empty removal list" },
]
features = ["core"]
[[functions]]
name = "paths"
category = "object"
description = "List all JSON pointer paths in value"
signature = "any -> array"
examples = [
{ code = '''paths({a: {b: 1}}) -> [\"/a\", \"/a/b\"]''', description = "Nested object" },
{ code = '''paths({a: 1, b: 2}) -> [\"/a\", \"/b\"]''', description = "Flat object" },
{ code = '''paths([1, 2]) -> [\"/0\", \"/1\"]''', description = "Array paths" },
{ code = '''paths({}) -> []''', description = "Empty object" },
]
features = ["core"]
[[functions]]
name = "pick"
category = "object"
description = "Select specific keys from object"
signature = "object, array -> object"
examples = [
{ code = "pick({a: 1, b: 2}, ['a']) -> {a: 1}", description = "Pick one key" },
{ code = "pick({a: 1, b: 2, c: 3}, ['a', 'c']) -> {a: 1, c: 3}", description = "Pick multiple keys" },
{ code = "pick({a: 1}, ['x']) -> {}", description = "Key not present" },
{ code = "pick({a: 1, b: 2}, []) -> {}", description = "Empty pick list" },
]
features = ["core"]
[[functions]]
name = "rename_keys"
category = "object"
description = "Rename object keys"
signature = "object, object -> object"
examples = [
{ code = "rename_keys({a: 1}, {a: 'b'}) -> {b: 1}", description = "Rename one key" },
{ code = "rename_keys({a: 1, b: 2}, {a: 'x', b: 'y'}) -> {x: 1, y: 2}", description = "Rename multiple" },
{ code = "rename_keys({a: 1}, {x: 'y'}) -> {a: 1}", description = "No matching key" },
{ code = "rename_keys({old: 'value'}, {old: 'new'}) -> {new: 'value'}", description = "Real-world rename" },
]
features = ["core"]
[[functions]]
name = "set_path"
category = "object"
description = "Set value at JSON pointer path (immutable)"
signature = "any, string, any -> any"
examples = [
{ code = "set_path({a: 1}, '/b', `2`) -> {a: 1, b: 2}", description = "Add new key" },
{ code = "set_path({a: 1}, '/a', `2`) -> {a: 2}", description = "Update existing" },
{ code = "set_path({a: {}}, '/a/b', `1`) -> {a: {b: 1}}", description = "Set nested path" },
{ code = "set_path([1, 2], '/1', `5`) -> [1, 5]", description = "Update array element" },
]
features = ["core"]
[[functions]]
name = "path_basename"
category = "path"
description = "Get filename from path"
signature = "string -> string"
examples = [
{ code = '''path_basename('/foo/bar.txt') -> \"bar.txt\"''', description = "Unix path" },
{ code = '''path_basename('/foo/bar/') -> \"bar\"''', description = "Directory path" },
{ code = '''path_basename('file.txt') -> \"file.txt\"''', description = "Just filename" },
]
features = ["core"]
[[functions]]
name = "path_dirname"
category = "path"
description = "Get directory from path"
signature = "string -> string"
examples = [
{ code = '''path_dirname('/foo/bar.txt') -> \"/foo\"''', description = "Unix path" },
{ code = '''path_dirname('/foo/bar/baz') -> \"/foo/bar\"''', description = "Nested path" },
{ code = '''path_dirname('file.txt') -> \"\"''', description = "No directory" },
]
features = ["core"]
[[functions]]
name = "path_ext"
category = "path"
description = "Get file extension"
signature = "string -> string"
examples = [
{ code = '''path_ext('/foo/bar.txt') -> \"txt\"''', description = "Text file" },
{ code = '''path_ext('image.png') -> \"png\"''', description = "Image file" },
{ code = '''path_ext('noext') -> \"\"''', description = "No extension" },
]
features = ["core"]
[[functions]]
name = "path_join"
category = "path"
description = "Join path segments"
signature = "string... -> string"
examples = [
{ code = '''path_join('/foo', 'bar', 'baz') -> \"/foo/bar/baz\"''', description = "Multiple segments" },
{ code = '''path_join('/home', 'user', 'file.txt') -> \"/home/user/file.txt\"''', description = "Full path" },
{ code = '''path_join('a', 'b') -> \"a/b\"''', description = "Relative path" },
]
features = ["core"]
[[functions]]
name = "caverphone"
category = "phonetic"
description = "Caverphone code"
signature = "string -> string"
examples = [
{ code = '''caverphone('Smith') -> \"SMT1111111\"''', description = "Common name" },
{ code = '''caverphone('Thompson') -> \"TMPSN11111\"''', description = "Another name" },
]
features = ["core"]
[[functions]]
name = "caverphone2"
category = "phonetic"
description = "Caverphone 2 code"
signature = "string -> string"
examples = [
{ code = '''caverphone2('Smith') -> \"SMT1111111\"''', description = "Common name" },
{ code = '''caverphone2('Thompson') -> \"TMPSN11111\"''', description = "Another name" },
]
features = ["core"]
[[functions]]
name = "double_metaphone"
category = "phonetic"
description = "Double Metaphone codes"
signature = "string -> object"
examples = [
{ code = "double_metaphone('Smith') -> {primary: 'SM0', secondary: 'XMT'}", description = "Common name" },
{ code = "double_metaphone('Schmidt') -> {primary: 'XMT', secondary: 'SMT'}", description = "German variant" },
]
features = ["core"]
[[functions]]
name = "match_rating_codex"
category = "phonetic"
description = "Match Rating codex"
signature = "string -> string"
examples = [
{ code = '''match_rating_codex('Smith') -> \"SMTH\"''', description = "Common name" },
{ code = '''match_rating_codex('Johnson') -> \"JHNSN\"''', description = "Another name" },
]
features = ["core"]
[[functions]]
name = "metaphone"
category = "phonetic"
description = "Metaphone phonetic code"
signature = "string -> string"
examples = [
{ code = '''metaphone('Smith') -> \"SM0\"''', description = "Common name" },
{ code = '''metaphone('phone') -> \"FN\"''', description = "Ph sound" },
]
features = ["core"]
[[functions]]
name = "nysiis"
category = "phonetic"
description = "NYSIIS phonetic code"
signature = "string -> string"
examples = [
{ code = '''nysiis('Smith') -> \"SNAT\"''', description = "Common name" },
{ code = '''nysiis('Johnson') -> \"JANSAN\"''', description = "Another name" },
]
features = ["core"]
[[functions]]
name = "phonetic_match"
category = "phonetic"
description = "Check phonetic match with algorithm"
signature = "string, string, string -> boolean"
examples = [
{ code = "phonetic_match('Smith', 'Smyth', 'soundex') -> true", description = "Soundex match" },
{ code = "phonetic_match('Robert', 'Rupert', 'metaphone') -> true", description = "Metaphone match" },
{ code = "phonetic_match('John', 'Jane', 'soundex') -> false", description = "No match" },
]
features = ["core"]
[[functions]]
name = "soundex"
category = "phonetic"
description = "Soundex phonetic code"
signature = "string -> string"
examples = [
{ code = '''soundex('Robert') -> \"R163\"''', description = "Common name" },
{ code = '''soundex('Rupert') -> \"R163\"''', description = "Same code as Robert" },
{ code = '''soundex('Smith') -> \"S530\"''', description = "Another name" },
]
features = ["core"]
[[functions]]
name = "sounds_like"
category = "phonetic"
description = "Check if strings sound similar"
signature = "string, string -> boolean"
examples = [
{ code = "sounds_like('Robert', 'Rupert') -> true", description = "Similar sounding" },
{ code = "sounds_like('Smith', 'Smyth') -> true", description = "Spelling variants" },
{ code = "sounds_like('John', 'Mary') -> false", description = "Different names" },
]
features = ["core"]
[[functions]]
name = "random"
category = "rand"
description = "Generate random number between 0 and 1"
signature = "-> number"
examples = [
{ code = "random() -> 0.123456...", description = "Random float" },
{ code = "floor(multiply(random(), `100`)) -> 42", description = "Random 0-99" },
]
features = ["core"]
[[functions]]
name = "sample"
category = "rand"
description = "Random sample from array"
signature = "array, number -> array"
examples = [
{ code = "sample([1, 2, 3, 4], `2`) -> [3, 1]", description = "Sample 2 items" },
{ code = "sample(['a', 'b', 'c'], `1`) -> ['b']", description = "Sample 1 item" },
{ code = "length(sample([1, 2, 3], `2`)) -> 2", description = "Always returns n items" },
]
features = ["core"]
[[functions]]
name = "shuffle"
category = "rand"
description = "Randomly shuffle array"
signature = "array -> array"
examples = [
{ code = "shuffle([1, 2, 3]) -> [2, 3, 1]", description = "Shuffle numbers" },
{ code = "length(shuffle([1, 2, 3])) -> 3", description = "Preserves length" },
]
features = ["core"]
[[functions]]
name = "regex_extract"
category = "regex"
description = "Extract regex matches"
signature = "string, string -> array"
examples = [
{ code = '''regex_extract('a1b2', '\\\\d+') -> [\"1\", \"2\"]''', description = "Extract numbers" },
{ code = '''regex_extract('hello world', '\\\\w+') -> [\"hello\", \"world\"]''', description = "Extract words" },
{ code = "regex_extract('abc', '\\\\d+') -> []", description = "No matches" },
]
features = ["core"]
[[functions]]
name = "regex_match"
category = "regex"
description = "Test if string matches regex"
signature = "string, string -> boolean"
examples = [
{ code = "regex_match('hello', '^h.*o$') -> true", description = "Full match" },
{ code = "regex_match('test123', '\\\\d+') -> true", description = "Contains digits" },
{ code = "regex_match('abc', '^\\\\d+$') -> false", description = "No match" },
]
features = ["core"]
[[functions]]
name = "regex_replace"
category = "regex"
description = "Replace regex matches"
signature = "string, string, string -> string"
examples = [
{ code = '''regex_replace('a1b2', '\\\\d+', 'X') -> \"aXbX\"''', description = "Replace digits" },
{ code = '''regex_replace('hello world', '\\\\s+', '-') -> \"hello-world\"''', description = "Replace spaces" },
{ code = '''regex_replace('abc', 'x', 'y') -> \"abc\"''', description = "No match unchanged" },
]
features = ["core"]
[[functions]]
name = "semver_compare"
category = "semver"
description = "Compare versions (-1, 0, 1)"
signature = "string, string -> number"
examples = [
{ code = "semver_compare('1.0.0', '2.0.0') -> -1", description = "Less than" },
{ code = "semver_compare('2.0.0', '1.0.0') -> 1", description = "Greater than" },
{ code = "semver_compare('1.0.0', '1.0.0') -> 0", description = "Equal" },
]
features = ["core"]
[[functions]]
name = "semver_is_valid"
category = "semver"
description = "Check if string is valid semver"
signature = "string -> boolean"
examples = [
{ code = "semver_is_valid('1.2.3') -> true", description = "Valid semver" },
{ code = "semver_is_valid('1.2.3-alpha') -> true", description = "With prerelease" },
{ code = "semver_is_valid('invalid') -> false", description = "Invalid format" },
]
features = ["core"]
[[functions]]
name = "semver_major"
category = "semver"
description = "Get major version"
signature = "string -> number"
examples = [
{ code = "semver_major('1.2.3') -> 1", description = "Major version" },
{ code = "semver_major('10.0.0') -> 10", description = "Double digit" },
{ code = "semver_major('0.1.0') -> 0", description = "Zero major" },
]
features = ["core"]
[[functions]]
name = "semver_minor"
category = "semver"
description = "Get minor version"
signature = "string -> number"
examples = [
{ code = "semver_minor('1.2.3') -> 2", description = "Minor version" },
{ code = "semver_minor('1.10.0') -> 10", description = "Double digit" },
{ code = "semver_minor('1.0.0') -> 0", description = "Zero minor" },
]
features = ["core"]
[[functions]]
name = "semver_parse"
category = "semver"
description = "Parse semantic version"
signature = "string -> object"
examples = [
{ code = "semver_parse('1.2.3') -> {major: 1, minor: 2, patch: 3}", description = "Basic version" },
{ code = "semver_parse('1.2.3-alpha').pre -> 'alpha'", description = "With prerelease" },
]
features = ["core"]
[[functions]]
name = "semver_patch"
category = "semver"
description = "Get patch version"
signature = "string -> number"
examples = [
{ code = "semver_patch('1.2.3') -> 3", description = "Patch version" },
{ code = "semver_patch('1.2.10') -> 10", description = "Double digit" },
{ code = "semver_patch('1.2.0') -> 0", description = "Zero patch" },
]
features = ["core"]
[[functions]]
name = "semver_satisfies"
category = "semver"
description = "Check if version matches constraint"
signature = "string, string -> boolean"
examples = [
{ code = "semver_satisfies('1.2.3', '^1.0.0') -> true", description = "Caret range" },
{ code = "semver_satisfies('2.0.0', '^1.0.0') -> false", description = "Outside range" },
{ code = "semver_satisfies('1.5.0', '>=1.0.0') -> true", description = "Comparison" },
]
features = ["core"]
[[functions]]
name = "abs"
category = "standard"
description = "Returns the absolute value of a number"
signature = "number -> number"
examples = [
{ code = "abs(`-5`) -> 5", description = "Negative number" },
{ code = "abs(`5`) -> 5", description = "Positive number" },
{ code = "abs(`0`) -> 0", description = "Zero" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "avg"
category = "standard"
description = "Returns the average of an array of numbers"
signature = "array[number] -> number"
examples = [
{ code = "avg([1, 2, 3]) -> 2", description = "Simple average" },
{ code = "avg([10, 20, 30, 40]) -> 25", description = "Four numbers" },
{ code = "avg([5]) -> 5", description = "Single element" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "ceil"
category = "standard"
description = "Returns the smallest integer greater than or equal to the number"
signature = "number -> number"
examples = [
{ code = "ceil(`1.5`) -> 2", description = "Round up decimal" },
{ code = "ceil(`-1.5`) -> -1", description = "Negative rounds toward zero" },
{ code = "ceil(`5`) -> 5", description = "Integer unchanged" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "contains"
category = "standard"
description = "Returns true if the subject contains the search value"
signature = "array|string, any -> boolean"
examples = [
{ code = "contains([1, 2, 3], `2`) -> true", description = "Array contains number" },
{ code = "contains('hello', 'ell') -> true", description = "String contains substring" },
{ code = "contains([1, 2, 3], `5`) -> false", description = "Not found" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "ends_with"
category = "standard"
description = "Returns true if the subject ends with the suffix"
signature = "string, string -> boolean"
examples = [
{ code = "ends_with('hello', 'lo') -> true", description = "Ends with suffix" },
{ code = "ends_with('hello', 'he') -> false", description = "Does not end with" },
{ code = "ends_with('test.txt', '.txt') -> true", description = "File extension" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "floor"
category = "standard"
description = "Returns the largest integer less than or equal to the number"
signature = "number -> number"
examples = [
{ code = "floor(`1.9`) -> 1", description = "Round down decimal" },
{ code = "floor(`-1.5`) -> -2", description = "Negative rounds away from zero" },
{ code = "floor(`5`) -> 5", description = "Integer unchanged" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "join"
category = "standard"
description = "Returns array elements joined into a string with a separator"
signature = "string, array[string] -> string"
examples = [
{ code = '''join(', ', ['a', 'b', 'c']) -> \"a, b, c\"''', description = "Join with comma" },
{ code = '''join('-', ['2024', '01', '15']) -> \"2024-01-15\"''', description = "Join date parts" },
{ code = '''join('', ['a', 'b', 'c']) -> \"abc\"''', description = "Join without separator" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "keys"
category = "standard"
description = "Returns an array of keys from an object"
signature = "object -> array[string]"
examples = [
{ code = '''keys({a: 1, b: 2}) -> [\"a\", \"b\"]''', description = "Get object keys" },
{ code = '''keys({name: \"John\", age: 30}) -> [\"age\", \"name\"]''', description = "Keys sorted alphabetically" },
{ code = "keys({}) -> []", description = "Empty object" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "length"
category = "standard"
description = "Returns the length of an array, object, or string"
signature = "array|object|string -> number"
examples = [
{ code = "length([1, 2, 3]) -> 3", description = "Array length" },
{ code = "length('hello') -> 5", description = "String length" },
{ code = "length({a: 1, b: 2}) -> 2", description = "Object key count" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "map"
category = "standard"
description = "Applies an expression to each element of an array"
signature = "expression, array -> array"
examples = [
{ code = "map(&a, [{a: 1}, {a: 2}]) -> [1, 2]", description = "Extract field from objects" },
{ code = "map(&length(@), ['a', 'bb', 'ccc']) -> [1, 2, 3]", description = "Apply function" },
{ code = "map(&@, [1, 2, 3]) -> [1, 2, 3]", description = "Identity mapping" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "max"
category = "standard"
description = "Returns the maximum value in an array"
signature = "array[number]|array[string] -> number|string"
examples = [
{ code = "max([1, 3, 2]) -> 3", description = "Max of numbers" },
{ code = "max(['a', 'c', 'b']) -> 'c'", description = "Max of strings" },
{ code = "max([-5, -1, -10]) -> -1", description = "Negative numbers" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "max_by"
category = "standard"
description = "Returns the element with maximum value by expression"
signature = "array, expression -> any"
examples = [
{ code = "max_by([{a: 1}, {a: 2}], &a) -> {a: 2}", description = "Max by field" },
{ code = "max_by([{name: 'a', age: 30}, {name: 'b', age: 25}], &age) -> {name: 'a', age: 30}", description = "Max by age" },
{ code = "max_by(['aa', 'b', 'ccc'], &length(@)) -> 'ccc'", description = "Max by length" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "merge"
category = "standard"
description = "Merges objects into a single object"
signature = "object... -> object"
examples = [
{ code = "merge({a: 1}, {b: 2}) -> {a: 1, b: 2}", description = "Merge two objects" },
{ code = "merge({a: 1}, {a: 2}) -> {a: 2}", description = "Later values override" },
{ code = "merge({a: 1}, {b: 2}, {c: 3}) -> {a: 1, b: 2, c: 3}", description = "Multiple objects" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "min"
category = "standard"
description = "Returns the minimum value in an array"
signature = "array[number]|array[string] -> number|string"
examples = [
{ code = "min([1, 3, 2]) -> 1", description = "Min of numbers" },
{ code = "min(['a', 'c', 'b']) -> 'a'", description = "Min of strings" },
{ code = "min([-5, -1, -10]) -> -10", description = "Negative numbers" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "min_by"
category = "standard"
description = "Returns the element with minimum value by expression"
signature = "array, expression -> any"
examples = [
{ code = "min_by([{a: 1}, {a: 2}], &a) -> {a: 1}", description = "Min by field" },
{ code = "min_by([{name: 'a', age: 30}, {name: 'b', age: 25}], &age) -> {name: 'b', age: 25}", description = "Min by age" },
{ code = "min_by(['aa', 'b', 'ccc'], &length(@)) -> 'b'", description = "Min by length" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "not_null"
category = "standard"
description = "Returns the first non-null argument"
signature = "any... -> any"
examples = [
{ code = '''not_null(`null`, 'a', 'b') -> \"a\"''', description = "Skip nulls" },
{ code = '''not_null('first', 'second') -> \"first\"''', description = "First non-null" },
{ code = "not_null(`null`, `null`, `1`) -> 1", description = "Multiple nulls" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "reverse"
category = "standard"
description = "Reverses an array or string"
signature = "array|string -> array|string"
examples = [
{ code = "reverse([1, 2, 3]) -> [3, 2, 1]", description = "Reverse array" },
{ code = "reverse('hello') -> 'olleh'", description = "Reverse string" },
{ code = "reverse([]) -> []", description = "Empty array" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "sort"
category = "standard"
description = "Sorts an array of numbers or strings"
signature = "array[number]|array[string] -> array"
examples = [
{ code = "sort([3, 1, 2]) -> [1, 2, 3]", description = "Sort numbers" },
{ code = "sort(['c', 'a', 'b']) -> ['a', 'b', 'c']", description = "Sort strings" },
{ code = "sort([]) -> []", description = "Empty array" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "sort_by"
category = "standard"
description = "Sorts an array by expression result"
signature = "array, expression -> array"
examples = [
{ code = "sort_by([{a: 2}, {a: 1}], &a) -> [{a: 1}, {a: 2}]", description = "Sort by field" },
{ code = "sort_by(['bb', 'a', 'ccc'], &length(@)) -> ['a', 'bb', 'ccc']", description = "Sort by length" },
{ code = "sort_by([{name: 'z'}, {name: 'a'}], &name) -> [{name: 'a'}, {name: 'z'}]", description = "Sort by name" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "starts_with"
category = "standard"
description = "Returns true if the subject starts with the prefix"
signature = "string, string -> boolean"
examples = [
{ code = "starts_with('hello', 'he') -> true", description = "Starts with prefix" },
{ code = "starts_with('hello', 'lo') -> false", description = "Does not start with" },
{ code = "starts_with('https://example.com', 'https') -> true", description = "URL protocol" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "sum"
category = "standard"
description = "Returns the sum of an array of numbers"
signature = "array[number] -> number"
examples = [
{ code = "sum([1, 2, 3]) -> 6", description = "Sum of numbers" },
{ code = "sum([10, -5, 3]) -> 8", description = "With negative" },
{ code = "sum([]) -> 0", description = "Empty array" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "to_array"
category = "standard"
description = "Converts a value to an array"
signature = "any -> array"
examples = [
{ code = '''to_array('hello') -> [\"hello\"]''', description = "String to array" },
{ code = "to_array([1, 2]) -> [1, 2]", description = "Array unchanged" },
{ code = "to_array(`5`) -> [5]", description = "Number to array" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "to_number"
category = "standard"
description = "Converts a value to a number"
signature = "any -> number"
examples = [
{ code = "to_number('42') -> 42", description = "String to number" },
{ code = "to_number('3.14') -> 3.14", description = "String to float" },
{ code = "to_number(`5`) -> 5", description = "Number unchanged" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "to_string"
category = "standard"
description = "Converts a value to a string"
signature = "any -> string"
examples = [
{ code = '''to_string(`42`) -> \"42\"''', description = "Number to string" },
{ code = '''to_string(`true`) -> \"true\"''', description = "Boolean to string" },
{ code = '''to_string('hello') -> \"hello\"''', description = "String unchanged" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "type"
category = "standard"
description = "Returns the type of a value as a string"
signature = "any -> string"
examples = [
{ code = '''type('hello') -> \"string\"''', description = "String type" },
{ code = '''type(`42`) -> \"number\"''', description = "Number type" },
{ code = '''type([1, 2]) -> \"array\"''', description = "Array type" },
{ code = '''type({a: 1}) -> \"object\"''', description = "Object type" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "values"
category = "standard"
description = "Returns an array of values from an object"
signature = "object -> array"
examples = [
{ code = "values({a: 1, b: 2}) -> [1, 2]", description = "Get object values" },
{ code = "values({x: 'hello', y: 'world'}) -> ['hello', 'world']", description = "String values" },
{ code = "values({}) -> []", description = "Empty object" },
]
is_standard = true
features = ["spec"]
[[functions]]
name = "abbreviate"
category = "string"
description = "Truncate string with ellipsis suffix"
signature = "string, number, string? -> string"
examples = [
{ code = '''abbreviate('hello world', `8`) -> \"hello...\"''', description = "Default ellipsis" },
{ code = '''abbreviate('hello', `10`) -> \"hello\"''', description = "No truncation needed" },
{ code = '''abbreviate('hello world', `8`, '>>') -> \"hello >>\"''', description = "Custom suffix" },
]
features = ["core"]
[[functions]]
name = "camel_case"
category = "string"
description = "Convert to camelCase"
signature = "string -> string"
examples = [
{ code = '''camel_case('hello_world') -> \"helloWorld\"''', description = "From snake_case" },
{ code = '''camel_case('hello-world') -> \"helloWorld\"''', description = "From kebab-case" },
{ code = '''camel_case('Hello World') -> \"helloWorld\"''', description = "From title case" },
]
features = ["core"]
[[functions]]
name = "capitalize"
category = "string"
description = "Capitalize the first character"
signature = "string -> string"
examples = [
{ code = '''capitalize('hello') -> \"Hello\"''', description = "Basic capitalize" },
{ code = '''capitalize('HELLO') -> \"HELLO\"''', description = "Already uppercase" },
{ code = '''capitalize('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "center"
category = "string"
description = "Center-pad string to given width"
signature = "string, number, string? -> string"
examples = [
{ code = '''center('hi', `6`) -> \" hi \"''', description = "Center with spaces" },
{ code = '''center('hi', `6`, '-') -> \"--hi--\"''', description = "Center with dashes" },
{ code = '''center('hello', `3`) -> \"hello\"''', description = "Already wider" },
]
features = ["core"]
[[functions]]
name = "concat"
category = "string"
description = "Concatenate strings"
signature = "string... -> string"
examples = [
{ code = '''concat('hello', ' ', 'world') -> \"hello world\"''', description = "Multiple strings" },
{ code = '''concat('a', 'b') -> \"ab\"''', description = "Two strings" },
{ code = '''concat('only') -> \"only\"''', description = "Single string" },
]
features = ["core"]
[[functions]]
name = "explode"
category = "string"
description = "Convert a string to an array of Unicode codepoints"
signature = "string -> array"
examples = [
{ code = "explode('abc') -> [97, 98, 99]", description = "ASCII characters" },
{ code = "explode('A☺') -> [65, 9786]", description = "Unicode characters" },
{ code = "explode('') -> []", description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "find_first"
category = "string"
description = "Find first occurrence of substring"
signature = "string, string -> number | null"
examples = [
{ code = "find_first('hello', 'l') -> 2", description = "Find character" },
{ code = "find_first('hello world', 'world') -> 6", description = "Find substring" },
{ code = "find_first('hello', 'x') -> null", description = "Not found" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "find_last"
category = "string"
description = "Find last occurrence of substring"
signature = "string, string -> number | null"
examples = [
{ code = "find_last('hello', 'l') -> 3", description = "Find last character" },
{ code = "find_last('foo bar foo', 'foo') -> 8", description = "Find last substring" },
{ code = "find_last('hello', 'x') -> null", description = "Not found" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "indices"
category = "string"
description = "Find all indices of substring occurrences"
signature = "string, string -> array"
examples = [
{ code = "indices('hello', 'l') -> [2, 3]", description = "Multiple occurrences" },
{ code = "indices('ababa', 'aba') -> [0, 2]", description = "Overlapping matches" },
{ code = "indices('hello', 'x') -> []", description = "No matches" },
]
features = ["core"]
[[functions]]
name = "implode"
category = "string"
description = "Convert an array of Unicode codepoints to a string"
signature = "array -> string"
examples = [
{ code = '''implode([97, 98, 99]) -> \"abc\"''', description = "ASCII codepoints" },
{ code = '''implode([65, 9786]) -> \"A☺\"''', description = "Unicode codepoints" },
{ code = '''implode([]) -> \"\"''', description = "Empty array" },
]
features = ["core"]
[[functions]]
name = "inside"
category = "string"
description = "Check if search string is contained in string"
signature = "string, string -> boolean"
examples = [
{ code = "inside('world', 'hello world') -> true", description = "Found" },
{ code = "inside('foo', 'hello world') -> false", description = "Not found" },
{ code = "inside('', 'hello') -> true", description = "Empty string always matches" },
]
features = ["core"]
[[functions]]
name = "is_blank"
category = "string"
description = "Check if string is empty or whitespace-only"
signature = "string -> boolean"
examples = [
{ code = "is_blank(' ') -> true", description = "Whitespace only" },
{ code = "is_blank('') -> true", description = "Empty string" },
{ code = "is_blank('hello') -> false", description = "Has content" },
]
features = ["core"]
[[functions]]
name = "kebab_case"
category = "string"
description = "Convert to kebab-case"
signature = "string -> string"
examples = [
{ code = '''kebab_case('helloWorld') -> \"hello-world\"''', description = "From camelCase" },
{ code = '''kebab_case('hello_world') -> \"hello-world\"''', description = "From snake_case" },
{ code = '''kebab_case('Hello World') -> \"hello-world\"''', description = "From title case" },
]
features = ["core"]
[[functions]]
name = "lower"
category = "string"
description = "Convert string to lowercase"
signature = "string -> string"
examples = [
{ code = '''lower('HELLO') -> \"hello\"''', description = "All uppercase" },
{ code = '''lower('Hello World') -> \"hello world\"''', description = "Mixed case" },
{ code = '''lower('hello') -> \"hello\"''', description = "Already lowercase" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "ltrimstr"
category = "string"
description = "Remove prefix from string if present"
signature = "string, string -> string"
examples = [
{ code = '''ltrimstr('foobar', 'foo') -> \"bar\"''', description = "Remove prefix" },
{ code = '''ltrimstr('foobar', 'bar') -> \"foobar\"''', description = "Prefix not found" },
{ code = '''ltrimstr('hello', '') -> \"hello\"''', description = "Empty prefix" },
]
features = ["core"]
[[functions]]
name = "mask"
category = "string"
description = "Mask string, keeping last N characters visible"
signature = "string, number?, string? -> string"
examples = [
{ code = '''mask('4111111111111111', `4`) -> \"************1111\"''', description = "Credit card" },
{ code = '''mask('secret', `0`) -> \"******\"''', description = "Mask all" },
{ code = '''mask('password', `4`, '#') -> \"####word\"''', description = "Custom mask char" },
]
features = ["core"]
[[functions]]
name = "normalize_whitespace"
category = "string"
description = "Collapse multiple whitespace to single space"
signature = "string -> string"
examples = [
{ code = '''normalize_whitespace('a b c') -> \"a b c\"''', description = "Multiple spaces" },
{ code = '''normalize_whitespace('a\\n\\nb') -> \"a b\"''', description = "Newlines to space" },
{ code = '''normalize_whitespace('hello') -> \"hello\"''', description = "Already normalized" },
]
features = ["core"]
[[functions]]
name = "pad_left"
category = "string"
description = "Pad string on the left to reach target length"
signature = "string, number, string -> string"
examples = [
{ code = '''pad_left('5', `3`, '0') -> \"005\"''', description = "Zero-pad number" },
{ code = '''pad_left('hi', `5`, ' ') -> \" hi\"''', description = "Right-align text" },
{ code = '''pad_left('hello', `3`, '0') -> \"hello\"''', description = "Already long enough" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "pad_right"
category = "string"
description = "Pad string on the right to reach target length"
signature = "string, number, string -> string"
examples = [
{ code = '''pad_right('5', `3`, '0') -> \"500\"''', description = "Pad with zeros" },
{ code = '''pad_right('hi', `5`, ' ') -> \"hi \"''', description = "Left-align text" },
{ code = '''pad_right('hello', `3`, '0') -> \"hello\"''', description = "Already long enough" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "redact"
category = "string"
description = "Redact regex pattern matches with replacement"
signature = "string, string, string? -> string"
examples = [
{ code = '''redact('email: test@example.com', '\\S+@\\S+', '[EMAIL]') -> \"email: [EMAIL]\"''', description = "Redact email" },
{ code = '''redact('call 555-1234', '\\d{3}-\\d{4}', '[PHONE]') -> \"call [PHONE]\"''', description = "Redact phone" },
{ code = '''redact('no match', 'xyz', '[X]') -> \"no match\"''', description = "No matches" },
]
features = ["core"]
[[functions]]
name = "repeat"
category = "string"
description = "Repeat a string n times"
signature = "string, number -> string"
examples = [
{ code = '''repeat('ab', `3`) -> \"ababab\"''', description = "Repeat 3 times" },
{ code = '''repeat('-', `5`) -> \"-----\"''', description = "Create separator" },
{ code = '''repeat('x', `0`) -> \"\"''', description = "Zero times" },
]
features = ["core"]
[[functions]]
name = "replace"
category = "string"
description = "Replace occurrences of a substring"
signature = "string, string, string -> string"
examples = [
{ code = '''replace('hello', 'l', 'L') -> \"heLLo\"''', description = "Replace all occurrences" },
{ code = '''replace('hello', 'x', 'y') -> \"hello\"''', description = "No match" },
{ code = '''replace('aaa', 'a', 'b') -> \"bbb\"''', description = "Replace all" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "reverse_string"
category = "string"
description = "Reverse a string"
signature = "string -> string"
examples = [
{ code = '''reverse_string('hello') -> \"olleh\"''', description = "Reverse word" },
{ code = '''reverse_string('ab') -> \"ba\"''', description = "Two chars" },
{ code = '''reverse_string('') -> \"\"''', description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "rtrimstr"
category = "string"
description = "Remove suffix from string if present"
signature = "string, string -> string"
examples = [
{ code = '''rtrimstr('foobar', 'bar') -> \"foo\"''', description = "Remove suffix" },
{ code = '''rtrimstr('hello.txt', '.txt') -> \"hello\"''', description = "Remove file extension" },
{ code = '''rtrimstr('hello', 'xyz') -> \"hello\"''', description = "Suffix not present" },
{ code = '''rtrimstr('barbar', 'bar') -> \"bar\"''', description = "Only removes once" },
]
features = ["core"]
[[functions]]
name = "slice"
category = "string"
description = "Extract substring by start and end index"
signature = "string, number, number -> string"
examples = [
{ code = '''slice('hello', `1`, `4`) -> \"ell\"''', description = "Middle slice" },
{ code = '''slice('hello', `0`, `2`) -> \"he\"''', description = "From start" },
{ code = '''slice('hello', `3`, `5`) -> \"lo\"''', description = "To end" },
{ code = '''slice('abcdef', `2`, `4`) -> \"cd\"''', description = "Two characters" },
]
features = ["core"]
[[functions]]
name = "snake_case"
category = "string"
description = "Convert to snake_case"
signature = "string -> string"
examples = [
{ code = '''snake_case('helloWorld') -> \"hello_world\"''', description = "From camelCase" },
{ code = '''snake_case('HelloWorld') -> \"hello_world\"''', description = "From PascalCase" },
{ code = '''snake_case('hello-world') -> \"hello_world\"''', description = "From kebab-case" },
{ code = '''snake_case('HELLO_WORLD') -> \"hello_world\"''', description = "From UPPER_CASE" },
]
features = ["core"]
[[functions]]
name = "split"
category = "string"
description = "Split string by delimiter"
signature = "string, string -> array"
examples = [
{ code = '''split('a,b,c', ',') -> [\"a\", \"b\", \"c\"]''', description = "Basic split" },
{ code = '''split('hello world', ' ') -> [\"hello\", \"world\"]''', description = "Split by space" },
{ code = '''split('no-delim', ',') -> [\"no-delim\"]''', description = "No delimiter found" },
{ code = '''split('', ',') -> [\"\"]''', description = "Empty string" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "sprintf"
category = "string"
description = "Printf-style string formatting"
signature = "string, any... -> string"
examples = [
{ code = '''sprintf('Pi is %.2f', `3.14159`) -> \"Pi is 3.14\"''', description = "Float formatting" },
{ code = '''sprintf('Hello %s', 'world') -> \"Hello world\"''', description = "String interpolation" },
{ code = '''sprintf('%d items', `42`) -> \"42 items\"''', description = "Integer formatting" },
{ code = '''sprintf('%s: %d', 'count', `5`) -> \"count: 5\"''', description = "Multiple args" },
]
features = ["core"]
[[functions]]
name = "substr"
category = "string"
description = "Extract substring by start index and length"
signature = "string, number, number -> string"
examples = [
{ code = '''substr('hello', `1`, `3`) -> \"ell\"''', description = "From index 1, length 3" },
{ code = '''substr('hello', `0`, `2`) -> \"he\"''', description = "From start" },
{ code = '''substr('abcdef', `2`, `2`) -> \"cd\"''', description = "Middle portion" },
{ code = '''substr('hello', `4`, `1`) -> \"o\"''', description = "Single character" },
]
features = ["core"]
[[functions]]
name = "title"
category = "string"
description = "Convert to title case"
signature = "string -> string"
examples = [
{ code = '''title('hello world') -> \"Hello World\"''', description = "Basic title case" },
{ code = '''title('HELLO WORLD') -> \"Hello World\"''', description = "From uppercase" },
{ code = '''title('hello') -> \"Hello\"''', description = "Single word" },
{ code = '''title('a b c') -> \"A B C\"''', description = "Single letters" },
]
features = ["core"]
[[functions]]
name = "trim"
category = "string"
description = "Remove leading and trailing whitespace"
signature = "string -> string"
examples = [
{ code = '''trim(' hello ') -> \"hello\"''', description = "Remove both sides" },
{ code = '''trim('hello') -> \"hello\"''', description = "No whitespace" },
{ code = '''trim(' ') -> \"\"''', description = "Only whitespace" },
{ code = '''trim('\t\nhello\t\n') -> \"hello\"''', description = "Tabs and newlines" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "trim_left"
category = "string"
description = "Remove leading whitespace"
signature = "string -> string"
examples = [
{ code = '''trim_left(' hello') -> \"hello\"''', description = "Remove leading spaces" },
{ code = '''trim_left('hello ') -> \"hello \"''', description = "Trailing preserved" },
{ code = '''trim_left('\t\thello') -> \"hello\"''', description = "Remove tabs" },
{ code = '''trim_left('hello') -> \"hello\"''', description = "No change needed" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "trim_right"
category = "string"
description = "Remove trailing whitespace"
signature = "string -> string"
examples = [
{ code = '''trim_right('hello ') -> \"hello\"''', description = "Remove trailing spaces" },
{ code = '''trim_right(' hello') -> \" hello\"''', description = "Leading preserved" },
{ code = '''trim_right('hello\t\t') -> \"hello\"''', description = "Remove tabs" },
{ code = '''trim_right('hello') -> \"hello\"''', description = "No change needed" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "upper"
category = "string"
description = "Convert string to uppercase"
signature = "string -> string"
examples = [
{ code = '''upper('hello') -> \"HELLO\"''', description = "Basic uppercase" },
{ code = '''upper('Hello World') -> \"HELLO WORLD\"''', description = "Mixed case" },
{ code = '''upper('HELLO') -> \"HELLO\"''', description = "Already uppercase" },
{ code = '''upper('abc123') -> \"ABC123\"''', description = "With numbers" },
]
jep = "JEP-014"
features = ["core", "jep"]
[[functions]]
name = "wrap"
category = "string"
description = "Wrap text to specified width"
signature = "string, number -> string"
examples = [
{ code = '''wrap('hello world', `5`) -> \"hello\\nworld\"''', description = "Wrap at word boundary" },
{ code = '''wrap('a b c d e', `3`) -> \"a b\\nc d\\ne\"''', description = "Multiple wraps" },
{ code = '''wrap('short', `10`) -> \"short\"''', description = "No wrap needed" },
{ code = '''wrap('one two three', `7`) -> \"one two\\nthree\"''', description = "Longer text" },
]
features = ["core"]
[[functions]]
name = "char_count"
category = "text"
description = "Count characters in text"
signature = "string -> number"
examples = [
{ code = "char_count('hello') -> 5", description = "Simple word" },
{ code = "char_count('hello world') -> 11", description = "With space" },
{ code = "char_count('') -> 0", description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "char_frequencies"
category = "text"
description = "Count character frequencies"
signature = "string -> object"
examples = [
{ code = "char_frequencies('aab') -> {a: 2, b: 1}", description = "Count repeated chars" },
{ code = "char_frequencies('hello') -> {e: 1, h: 1, l: 2, o: 1}", description = "Word frequencies" },
{ code = "char_frequencies('') -> {}", description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "paragraph_count"
category = "text"
description = "Count paragraphs in text"
signature = "string -> number"
examples = [
{ code = '''paragraph_count('A\\n\\nB') -> 2''', description = "Two paragraphs" },
{ code = '''paragraph_count('Single paragraph') -> 1''', description = "Single paragraph" },
{ code = '''paragraph_count('A\\n\\nB\\n\\nC') -> 3''', description = "Three paragraphs" },
]
features = ["core"]
[[functions]]
name = "reading_time"
category = "text"
description = "Estimate reading time"
signature = "string -> string"
examples = [
{ code = '''reading_time('The quick brown fox') -> \"1 min read\"''', description = "Short text" },
{ code = '''reading_time('') -> \"1 min read\"''', description = "Empty text minimum" },
]
features = ["core"]
[[functions]]
name = "reading_time_seconds"
category = "text"
description = "Estimate reading time in seconds"
signature = "string -> number"
examples = [
{ code = "reading_time_seconds('The quick brown fox jumps over the lazy dog') -> 2", description = "Short sentence" },
{ code = "reading_time_seconds('') -> 0", description = "Empty text" },
]
features = ["core"]
[[functions]]
name = "sentence_count"
category = "text"
description = "Count sentences in text"
signature = "string -> number"
examples = [
{ code = "sentence_count('Hello. World!') -> 2", description = "Two sentences" },
{ code = "sentence_count('One sentence') -> 1", description = "Single sentence" },
{ code = "sentence_count('What? Yes! No.') -> 3", description = "Different terminators" },
]
features = ["core"]
[[functions]]
name = "word_count"
category = "text"
description = "Count words in text"
signature = "string -> number"
examples = [
{ code = "word_count('hello world') -> 2", description = "Two words" },
{ code = "word_count('one') -> 1", description = "Single word" },
{ code = "word_count('') -> 0", description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "word_frequencies"
category = "text"
description = "Count word frequencies"
signature = "string -> object"
examples = [
{ code = "word_frequencies('a a b') -> {a: 2, b: 1}", description = "Count repeated words" },
{ code = "word_frequencies('the quick brown fox') -> {brown: 1, fox: 1, quick: 1, the: 1}", description = "Unique words" },
{ code = "word_frequencies('') -> {}", description = "Empty string" },
]
features = ["core"]
[[functions]]
name = "ngrams"
category = "text"
description = "Generate n-grams from text (word or character)"
signature = "string, number, string? -> array"
examples = [
{ code = "ngrams('hello', `3`, 'char') -> \\['hel', 'ell', 'llo'\\]", description = "Character trigrams" },
{ code = "ngrams('a b c d', `2`, 'word') -> \\[\\['a', 'b'\\], \\['b', 'c'\\], \\['c', 'd'\\]\\]", description = "Word bigrams" },
{ code = "ngrams('ab', `3`, 'char') -> \\[\\]", description = "Text shorter than n" },
]
features = ["core"]
[[functions]]
name = "bigrams"
category = "text"
description = "Generate word bigrams (2-grams)"
signature = "string -> array"
examples = [
{ code = "bigrams('a b c') -> \\[\\['a', 'b'\\], \\['b', 'c'\\]\\]", description = "Basic bigrams" },
{ code = "bigrams('the quick brown fox') -> \\[\\['the', 'quick'\\], \\['quick', 'brown'\\], \\['brown', 'fox'\\]\\]", description = "Sentence bigrams" },
{ code = "bigrams('single') -> \\[\\]", description = "Single word" },
]
features = ["core"]
[[functions]]
name = "trigrams"
category = "text"
description = "Generate word trigrams (3-grams)"
signature = "string -> array"
examples = [
{ code = "trigrams('a b c d') -> \\[\\['a', 'b', 'c'\\], \\['b', 'c', 'd'\\]\\]", description = "Basic trigrams" },
{ code = "trigrams('the quick brown fox jumps') -> \\[\\['the', 'quick', 'brown'\\], \\['quick', 'brown', 'fox'\\], \\['brown', 'fox', 'jumps'\\]\\]", description = "Sentence trigrams" },
{ code = "trigrams('a b') -> \\[\\]", description = "Too few words" },
]
features = ["core"]
[[functions]]
name = "is_array"
category = "type"
description = "Check if value is an array"
signature = "any -> boolean"
examples = [
{ code = "is_array([1, 2]) -> true", description = "Array returns true" },
{ code = "is_array('hello') -> false", description = "String returns false" },
{ code = "is_array({}) -> false", description = "Object returns false" },
{ code = "is_array([]) -> true", description = "Empty array is array" },
]
features = ["core"]
[[functions]]
name = "is_boolean"
category = "type"
description = "Check if value is a boolean"
signature = "any -> boolean"
examples = [
{ code = "is_boolean(`true`) -> true", description = "True is boolean" },
{ code = "is_boolean(`false`) -> true", description = "False is boolean" },
{ code = "is_boolean('true') -> false", description = "String is not boolean" },
{ code = "is_boolean(`1`) -> false", description = "Number is not boolean" },
]
features = ["core"]
[[functions]]
name = "is_empty"
category = "type"
description = "Check if value is empty"
signature = "any -> boolean"
examples = [
{ code = "is_empty([]) -> true", description = "Empty array" },
{ code = "is_empty('') -> true", description = "Empty string" },
{ code = "is_empty({}) -> true", description = "Empty object" },
{ code = "is_empty([1, 2]) -> false", description = "Non-empty array" },
]
features = ["core"]
[[functions]]
name = "is_null"
category = "type"
description = "Check if value is null"
signature = "any -> boolean"
examples = [
{ code = "is_null(`null`) -> true", description = "Null returns true" },
{ code = "is_null('') -> false", description = "Empty string is not null" },
{ code = "is_null(`0`) -> false", description = "Zero is not null" },
{ code = "is_null(missing_field) -> true", description = "Missing field is null" },
]
features = ["core"]
[[functions]]
name = "is_number"
category = "type"
description = "Check if value is a number"
signature = "any -> boolean"
examples = [
{ code = "is_number(`42`) -> true", description = "Integer is number" },
{ code = "is_number(`3.14`) -> true", description = "Float is number" },
{ code = "is_number('42') -> false", description = "String is not number" },
{ code = "is_number(`null`) -> false", description = "Null is not number" },
]
features = ["core"]
[[functions]]
name = "is_object"
category = "type"
description = "Check if value is an object"
signature = "any -> boolean"
examples = [
{ code = "is_object({a: 1}) -> true", description = "Object returns true" },
{ code = "is_object({}) -> true", description = "Empty object is object" },
{ code = "is_object([]) -> false", description = "Array is not object" },
{ code = "is_object('hello') -> false", description = "String is not object" },
]
features = ["core"]
[[functions]]
name = "is_string"
category = "type"
description = "Check if value is a string"
signature = "any -> boolean"
examples = [
{ code = "is_string('hello') -> true", description = "String returns true" },
{ code = "is_string('') -> true", description = "Empty string is string" },
{ code = "is_string(`42`) -> false", description = "Number is not string" },
{ code = "is_string([]) -> false", description = "Array is not string" },
]
features = ["core"]
[[functions]]
name = "to_boolean"
category = "type"
description = "Convert value to boolean"
signature = "any -> boolean"
examples = [
{ code = "to_boolean('true') -> true", description = "String 'true'" },
{ code = "to_boolean('false') -> false", description = "String 'false'" },
{ code = "to_boolean(`1`) -> true", description = "Non-zero is true" },
{ code = "to_boolean(`0`) -> false", description = "Zero is false" },
]
features = ["core"]
[[functions]]
name = "type_of"
category = "type"
description = "Get the type of a value"
signature = "any -> string"
examples = [
{ code = '''type_of(`42`) -> \"number\"''', description = "Number type" },
{ code = '''type_of('hello') -> \"string\"''', description = "String type" },
{ code = '''type_of([1, 2]) -> \"array\"''', description = "Array type" },
{ code = '''type_of({a: 1}) -> \"object\"''', description = "Object type" },
]
features = ["core"]
[[functions]]
name = "url_decode"
category = "url"
description = "URL decode a string"
signature = "string -> string"
examples = [
{ code = '''url_decode('hello%20world') -> \"hello world\"''', description = "Decode space" },
{ code = '''url_decode('a%2Bb') -> \"a+b\"''', description = "Decode plus sign" },
{ code = '''url_decode('100%25') -> \"100%\"''', description = "Decode percent" },
{ code = '''url_decode('hello') -> \"hello\"''', description = "No encoding" },
]
features = ["core"]
[[functions]]
name = "url_encode"
category = "url"
description = "URL encode a string"
signature = "string -> string"
examples = [
{ code = '''url_encode('hello world') -> \"hello%20world\"''', description = "Encode space" },
{ code = '''url_encode('a+b') -> \"a%2Bb\"''', description = "Encode plus" },
{ code = '''url_encode('100%') -> \"100%25\"''', description = "Encode percent" },
{ code = '''url_encode('hello') -> \"hello\"''', description = "No special chars" },
]
features = ["core"]
[[functions]]
name = "url_parse"
category = "url"
description = "Parse URL into components"
signature = "string -> object"
examples = [
{ code = "url_parse('https://example.com/path') -> {scheme: 'https', ...}", description = "Parse full URL" },
{ code = "url_parse('http://user:pass@host:8080') -> components", description = "With auth and port" },
{ code = "url_parse('https://api.example.com/v1?key=val') -> with query", description = "With query string" },
{ code = "url_parse('/path/to/file') -> relative path", description = "Relative URL" },
]
features = ["core"]
[[functions]]
name = "coalesce"
category = "utility"
description = "Return first non-null value"
signature = "any... -> any"
examples = [
{ code = '''coalesce(`null`, `null`, 'value') -> \"value\"''', description = "Skip nulls" },
{ code = "coalesce(field1, field2, 'default') -> first non-null", description = "Field fallback" },
{ code = "coalesce('first', 'second') -> 'first'", description = "First wins" },
{ code = "coalesce(`null`, `null`) -> null", description = "All null" },
]
features = ["core"]
[[functions]]
name = "default"
category = "utility"
description = "Return default value if null"
signature = "any, any -> any"
examples = [
{ code = '''default(`null`, 'fallback') -> \"fallback\"''', description = "Null uses default" },
{ code = "default('value', 'fallback') -> 'value'", description = "Non-null keeps value" },
{ code = "default(missing_field, `0`) -> 0", description = "Missing field default" },
{ code = "default('', 'fallback') -> ''", description = "Empty string not null" },
]
features = ["core"]
[[functions]]
name = "if"
category = "utility"
description = "Conditional expression"
signature = "boolean, any, any -> any"
examples = [
{ code = '''if(`true`, 'yes', 'no') -> \"yes\"''', description = "True branch" },
{ code = '''if(`false`, 'yes', 'no') -> \"no\"''', description = "False branch" },
{ code = "if(age >= `18`, 'adult', 'minor') -> depends", description = "Conditional logic" },
{ code = "if(is_empty(arr), 'none', first(arr)) -> value or none", description = "Safe access" },
]
features = ["core"]
[[functions]]
name = "json_decode"
category = "utility"
description = "Parse JSON string"
signature = "string -> any"
examples = [
{ code = '''json_decode('{\"a\": 1}') -> {a: 1}''', description = "Parse object" },
{ code = '''json_decode('[1, 2, 3]') -> [1, 2, 3]''', description = "Parse array" },
{ code = '''json_decode('\"hello\"') -> \"hello\"''', description = "Parse string" },
{ code = "json_decode(json_field) -> parsed", description = "Parse field" },
]
features = ["core"]
[[functions]]
name = "json_encode"
category = "utility"
description = "Serialize value to JSON string"
signature = "any -> string"
examples = [
{ code = '''json_encode({a: 1}) -> \"{\\\"a\\\":1}\"''', description = "Encode object" },
{ code = '''json_encode([1, 2, 3]) -> \"[1,2,3]\"''', description = "Encode array" },
{ code = '''json_encode('hello') -> \"\\\"hello\\\"\"''', description = "Encode string" },
{ code = "json_encode(data) -> JSON string", description = "Encode any value" },
]
features = ["core"]
[[functions]]
name = "json_pointer"
category = "utility"
description = "Access value using JSON Pointer (RFC 6901)"
signature = "any, string -> any"
examples = [
{ code = "json_pointer({foo: {bar: 1}}, '/foo/bar') -> 1", description = "Nested access" },
{ code = "json_pointer(data, '/0/name') -> first item name", description = "Array access" },
{ code = "json_pointer({a: 1}, '/a') -> 1", description = "Top-level access" },
{ code = "json_pointer(data, '/missing') -> null", description = "Missing path" },
]
features = ["core"]
[[functions]]
name = "now"
category = "utility"
description = "Current Unix timestamp in seconds"
signature = "-> number"
examples = [
{ code = "now() -> 1699900000", description = "Current timestamp" },
{ code = "now() - 3600 -> one hour ago", description = "Subtract seconds" },
{ code = "now() + 86400 -> tomorrow", description = "Add one day" },
{ code = "from_epoch(now()) -> current ISO", description = "Convert to string" },
]
features = ["core"]
[[functions]]
name = "now_ms"
category = "utility"
description = "Current Unix timestamp in milliseconds"
signature = "-> number"
examples = [
{ code = "now_ms() -> 1699900000000", description = "Current time in ms" },
{ code = "now_ms() - start_ms -> elapsed ms", description = "Calculate duration" },
{ code = "now_ms() / `1000` -> seconds", description = "Convert to seconds" },
{ code = "from_epoch_ms(now_ms()) -> current ISO", description = "Convert to string" },
]
features = ["core"]
[[functions]]
name = "pretty"
category = "utility"
description = "Pretty-print value as formatted JSON string"
signature = "any, number? -> string"
examples = [
{ code = '''pretty({a: 1}) -> \"{\n \\\"a\\\": 1\n}\"''', description = "Default 2-space indent" },
{ code = '''pretty({a: 1}, `4`) -> 4-space indent''', description = "Custom indent" },
{ code = "pretty(config) -> readable JSON", description = "Format for display" },
{ code = "sprintf('Config:\\n%s', pretty(@)) -> embedded", description = "Embed in output" },
]
features = ["core"]
[[functions]]
name = "uuid"
category = "uuid"
description = "Generate a UUID v4"
signature = "-> string"
examples = [
{ code = '''uuid() -> \"550e8400-e29b-41d4-a716-446655440000\"''', description = "Generate UUID" },
{ code = "uuid() -> random unique ID", description = "Each call is unique" },
{ code = "{id: uuid(), name: 'item'} -> with UUID", description = "Add ID to object" },
]
features = ["core"]
[[functions]]
name = "is_base64"
category = "validation"
description = "Check if valid Base64 encoding"
signature = "string -> boolean"
examples = [
{ code = "is_base64('SGVsbG8=') -> true", description = "Valid base64" },
{ code = "is_base64('not valid!') -> false", description = "Invalid chars" },
{ code = "is_base64('') -> true", description = "Empty is valid" },
]
features = ["core"]
[[functions]]
name = "is_credit_card"
category = "validation"
description = "Validate credit card number (Luhn check + length)"
signature = "string -> boolean"
examples = [
{ code = "is_credit_card('4111111111111111') -> true", description = "Valid Visa test number" },
{ code = "is_credit_card('1234567890123456') -> false", description = "Invalid number" },
{ code = "is_credit_card('5500000000000004') -> true", description = "Valid Mastercard test" },
]
features = ["core"]
[[functions]]
name = "is_email"
category = "validation"
description = "Validate email address format"
signature = "string -> boolean"
examples = [
{ code = "is_email('user@example.com') -> true", description = "Valid email" },
{ code = "is_email('invalid-email') -> false", description = "Missing @" },
{ code = "is_email('user@sub.domain.com') -> true", description = "Subdomain" },
]
features = ["core"]
[[functions]]
name = "is_hex"
category = "validation"
description = "Check if valid hexadecimal string"
signature = "string -> boolean"
examples = [
{ code = "is_hex('deadbeef') -> true", description = "Valid hex" },
{ code = "is_hex('ABCDEF') -> true", description = "Uppercase hex" },
{ code = "is_hex('ghijkl') -> false", description = "Invalid chars" },
]
features = ["core"]
[[functions]]
name = "is_ipv4"
category = "validation"
description = "Validate IPv4 address format"
signature = "string -> boolean"
examples = [
{ code = "is_ipv4('192.168.1.1') -> true", description = "Valid IPv4" },
{ code = "is_ipv4('256.1.1.1') -> false", description = "Out of range" },
{ code = "is_ipv4('10.0.0.1') -> true", description = "Private IP" },
]
features = ["core"]
[[functions]]
name = "is_ipv6"
category = "validation"
description = "Validate IPv6 address format"
signature = "string -> boolean"
examples = [
{ code = "is_ipv6('::1') -> true", description = "Loopback" },
{ code = "is_ipv6('2001:db8::1') -> true", description = "Full IPv6" },
{ code = "is_ipv6('192.168.1.1') -> false", description = "IPv4 is not IPv6" },
]
features = ["core"]
[[functions]]
name = "is_iso_date"
category = "validation"
description = "Validate ISO 8601 date format"
signature = "string -> boolean"
examples = [
{ code = "is_iso_date('2023-12-13T15:30:00Z') -> true", description = "Full ISO format" },
{ code = "is_iso_date('2023-12-13') -> true", description = "Date only" },
{ code = "is_iso_date('12/13/2023') -> false", description = "US format invalid" },
]
features = ["core"]
[[functions]]
name = "is_json"
category = "validation"
description = "Check if string is valid JSON"
signature = "string -> boolean"
examples = [
{ code = '''is_json('{\"a\": 1}') -> true''', description = "Valid JSON object" },
{ code = "is_json('[1, 2, 3]') -> true", description = "Valid JSON array" },
{ code = "is_json('not json') -> false", description = "Invalid JSON" },
]
features = ["core"]
[[functions]]
name = "is_jwt"
category = "validation"
description = "Check if valid JWT structure (3 base64url parts)"
signature = "string -> boolean"
examples = [
{ code = "is_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U') -> true", description = "Valid JWT" },
{ code = "is_jwt('eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiSm9obiJ9.signature') -> true", description = "Three parts with dots" },
{ code = "is_jwt('not.a.valid.jwt') -> false", description = "Four parts" },
{ code = "is_jwt('invalid') -> false", description = "No dots" },
]
features = ["core"]
[[functions]]
name = "is_phone"
category = "validation"
description = "Validate phone number format"
signature = "string -> boolean"
examples = [
{ code = "is_phone('+1-555-123-4567') -> true", description = "US format with country code" },
{ code = "is_phone('555-123-4567') -> true", description = "US format without country code" },
{ code = "is_phone('+44 20 7946 0958') -> true", description = "UK format" },
{ code = "is_phone('invalid') -> false", description = "Invalid phone" },
]
features = ["core"]
[[functions]]
name = "is_url"
category = "validation"
description = "Validate URL format"
signature = "string -> boolean"
examples = [
{ code = "is_url('https://example.com') -> true", description = "Simple HTTPS URL" },
{ code = "is_url('http://localhost:8080/path') -> true", description = "URL with port and path" },
{ code = "is_url('ftp://files.example.com') -> true", description = "FTP URL" },
{ code = "is_url('not a url') -> false", description = "Invalid URL" },
]
features = ["core"]
[[functions]]
name = "is_uuid"
category = "validation"
description = "Validate UUID format"
signature = "string -> boolean"
examples = [
{ code = "is_uuid('550e8400-e29b-41d4-a716-446655440000') -> true", description = "Valid UUID v4" },
{ code = "is_uuid('6ba7b810-9dad-11d1-80b4-00c04fd430c8') -> true", description = "Valid UUID v1" },
{ code = "is_uuid('00000000-0000-0000-0000-000000000000') -> true", description = "Nil UUID" },
{ code = "is_uuid('not-a-uuid') -> false", description = "Invalid format" },
]
features = ["core"]
[[functions]]
name = "luhn_check"
category = "validation"
description = "Generic Luhn algorithm check"
signature = "string -> boolean"
examples = [
{ code = "luhn_check('79927398713') -> true", description = "Valid Luhn number" },
{ code = "luhn_check('4532015112830366') -> true", description = "Valid credit card number" },
{ code = "luhn_check('1234567890') -> false", description = "Invalid Luhn" },
{ code = "luhn_check('0') -> true", description = "Single zero" },
]
features = ["core"]
[[functions]]
name = "to_csv"
category = "format"
description = "Convert array to CSV row string (RFC 4180 compliant)"
signature = "array -> string"
examples = [
{ code = '''to_csv(['a', 'b', 'c']) -> "a,b,c"''', description = "Simple strings" },
{ code = '''to_csv(['hello', `42`, `true`, `null`]) -> "hello,42,true,"''', description = "Mixed types" },
{ code = '''to_csv(['hello, world', 'test']) -> "\"hello, world\",test"''', description = "Value with comma is quoted" },
{ code = '''to_csv(['say "hello"', 'test']) -> "\"say \"\"hello\"\"\",test"''', description = "Quotes are doubled" },
]
features = ["format"]
[[functions]]
name = "to_tsv"
category = "format"
description = "Convert array to TSV row string (tab-separated)"
signature = "array -> string"
examples = [
{ code = '''to_tsv(['a', 'b', 'c']) -> "a\tb\tc"''', description = "Simple strings" },
{ code = '''to_tsv(['hello', `42`, `true`]) -> "hello\t42\ttrue"''', description = "Mixed types" },
]
features = ["format"]
[[functions]]
name = "to_csv_rows"
category = "format"
description = "Convert array of arrays to multi-line CSV string"
signature = "array -> string"
examples = [
{ code = '''to_csv_rows([[`1`, `2`, `3`], [`4`, `5`, `6`]]) -> "1,2,3\n4,5,6"''', description = "Numeric rows" },
{ code = '''to_csv_rows([['a', 'b'], ['c', 'd']]) -> "a,b\nc,d"''', description = "String rows" },
{ code = '''to_csv_rows([]) -> ""''', description = "Empty array" },
]
features = ["format"]
[[functions]]
name = "to_csv_table"
category = "format"
description = "Convert array of objects to CSV with header row"
signature = "array, array? -> string"
examples = [
{ code = '''to_csv_table([{name: 'alice', age: `30`}]) -> "age,name\n30,alice"''', description = "Keys sorted alphabetically" },
{ code = '''to_csv_table([{name: 'alice', age: `30`}], ['name', 'age']) -> "name,age\nalice,30"''', description = "Explicit column order" },
{ code = '''to_csv_table([{a: `1`}, {a: `2`, b: `3`}], ['a', 'b']) -> "a,b\n1,\n2,3"''', description = "Missing fields become empty" },
{ code = '''to_csv_table([]) -> ""''', description = "Empty array" },
]
features = ["format"]
[[functions]]
name = "env"
category = "utility"
description = "Get all environment variables as an object"
signature = "-> object"
examples = [
{ code = "env() -> {HOME: '/Users/...', PATH: '...', ...}", description = "All env vars" },
{ code = "env().HOME -> home directory", description = "Access specific var" },
{ code = "keys(env()) -> list of var names", description = "List all var names" },
]
features = ["env"]
[[functions]]
name = "get_env"
category = "utility"
description = "Get a single environment variable by name"
signature = "string -> string | null"
examples = [
{ code = '''get_env('HOME') -> \"/Users/josh\"''', description = "Get home directory" },
{ code = "get_env('PATH') -> system PATH", description = "Get PATH" },
{ code = "get_env('MISSING') -> null", description = "Returns null if not set" },
{ code = "default(get_env('PORT'), '8080') -> with fallback", description = "With default value" },
]
features = ["env"]