jexl-extended
Version:
Extended grammar for Javascript Expression Language (JEXL)
1,018 lines (1,017 loc) • 201 kB
JavaScript
// Auto-generated completion documentation
// This file is generated by completion-docs.ts - do not edit manually
export const completionDocs = [
{
"type": "function",
"name": "absoluteValue",
"label": "abs",
"description": "Returns the absolute value of a number.",
"detail": "JEXL function",
"documentation": "Returns the absolute value of a number.\n\n**Examples:**\n`absoluteValue(-5) // 5`\n`(-10)|absoluteValue // 10`\n`absoluteValue(3.14) // 3.14`\n\n**Parameters:**\n- `input` (unknown): The input number to get the absolute value of.\n\n**Returns:** The absolute value, or NaN if input cannot be converted to a number.",
"examples": [
"absoluteValue(-5) // 5",
"(-10)|absoluteValue // 10",
"absoluteValue(3.14) // 3.14"
],
"parameters": [
{
"name": "input",
"description": "The input number to get the absolute value of.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The absolute value, or NaN if input cannot be converted to a number."
},
"insertText": "abs(${1:input})",
"aliases": [
"absoluteValue"
]
},
{
"type": "function",
"name": "arrayEvery",
"label": "all",
"description": "Checks whether the provided array has all elements that match the specified expression.",
"detail": "JEXL function",
"documentation": "Checks whether the provided array has all elements that match the specified expression.\nThe expression must be a valid JEXL expression string, and is applied to each element of the array.\nThe relative context provided to the expression is an object with the properties value, index and array (the original array).\n\n**Examples:**\n`every([2, 4, 6], \"value % 2 == 0\") // true`\n`[{age: 25}, {age: 35}]|every(\"value.age > 20\") // true`\n`every([1, 2, 3], \"value > 2\") // false`\n\n**Parameters:**\n- `input` (array): The input array to test.\n- `expression` (string): The JEXL expression to test against each element (supports value, index and array as context).\n\n**Returns:** True if all elements match the expression, false otherwise or if input is not an array.",
"examples": [
"every([2, 4, 6], \"value % 2 == 0\") // true",
"[{age: 25}, {age: 35}]|every(\"value.age > 20\") // true",
"every([1, 2, 3], \"value > 2\") // false"
],
"parameters": [
{
"name": "input",
"description": "The input array to test.",
"type": "array",
"optional": false
},
{
"name": "expression",
"description": "The JEXL expression to test against each element (supports value, index and array as context).",
"type": "string",
"optional": false
}
],
"returns": {
"type": "boolean",
"description": "True if all elements match the expression, false otherwise or if input is not an array."
},
"insertText": "all(${1:input}, ${2:expression})",
"aliases": [
"arrayEvery",
"every"
]
},
{
"type": "function",
"name": "arrayAny",
"label": "any",
"description": "Checks whether the provided array has any elements that match the specified expression.",
"detail": "JEXL function",
"documentation": "Checks whether the provided array has any elements that match the specified expression.\nThe expression must be a valid JEXL expression string, and is applied to each element of the array.\nThe relative context provided to the expression is an object with the properties value, index and array (the original array).\n\n**Examples:**\n`any([1, 2, 3], \"value > 2\") // true`\n`[{age: 25}, {age: 35}]|any(\"value.age > 30\") // true`\n`any([1, 2, 3], \"value > 5\") // false`\n\n**Parameters:**\n- `input` (array): The input array to test.\n- `expression` (string): The JEXL expression to test against each element (supports value, index and array as context).\n\n**Returns:** True if any element matches the expression, false otherwise or if input is not an array.",
"examples": [
"any([1, 2, 3], \"value > 2\") // true",
"[{age: 25}, {age: 35}]|any(\"value.age > 30\") // true",
"any([1, 2, 3], \"value > 5\") // false"
],
"parameters": [
{
"name": "input",
"description": "The input array to test.",
"type": "array",
"optional": false
},
{
"name": "expression",
"description": "The JEXL expression to test against each element (supports value, index and array as context).",
"type": "string",
"optional": false
}
],
"returns": {
"type": "boolean",
"description": "True if any element matches the expression, false otherwise or if input is not an array."
},
"insertText": "any(${1:input}, ${2:expression})",
"aliases": [
"arrayAny",
"some"
]
},
{
"type": "function",
"name": "arrayAppend",
"label": "append",
"description": "Appends elements to an array.",
"detail": "JEXL function",
"documentation": "Appends elements to an array.\n\n**Examples:**\n`append([1, 2], 3) // [1, 2, 3]`\n`[1, 2]|append(3, 4) // [1, 2, 3, 4]`\n`append([], 1, 2, 3) // [1, 2, 3]`\n\n**Parameters:**\n- `input` (array): The input values to append to an array.\n\n**Returns:** A new array with all inputs flattened and appended, or empty array if no valid input.",
"examples": [
"append([1, 2], 3) // [1, 2, 3]",
"[1, 2]|append(3, 4) // [1, 2, 3, 4]",
"append([], 1, 2, 3) // [1, 2, 3]"
],
"parameters": [
{
"name": "input",
"description": "The input values to append to an array.",
"type": "array",
"optional": false
}
],
"returns": {
"type": "array",
"description": "A new array with all inputs flattened and appended, or empty array if no valid input."
},
"insertText": "append(${1:input})",
"aliases": [
"arrayAppend",
"concat"
]
},
{
"type": "function",
"name": "average",
"label": "average",
"description": "Calculates the average of an array of numbers.",
"detail": "JEXL function",
"documentation": "Calculates the average of an array of numbers.\n\n**Examples:**\n`average([1, 2, 3, 4]) // 2.5`\n`[10, 20, 30]|average // 20`\n`average(1, 2, 3, 4) // 2.5`\n\n**Parameters:**\n- `input` (array): The input array of numbers or individual number arguments.\n\n**Returns:** The average value, or NaN if input is not an array.",
"examples": [
"average([1, 2, 3, 4]) // 2.5",
"[10, 20, 30]|average // 20",
"average(1, 2, 3, 4) // 2.5"
],
"parameters": [
{
"name": "input",
"description": "The input array of numbers or individual number arguments.",
"type": "array",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The average value, or NaN if input is not an array."
},
"insertText": "average(${1:input})",
"aliases": [
"avg"
]
},
{
"type": "function",
"name": "base64Decode",
"label": "base64Decode",
"description": "Decodes a Base64 encoded string.",
"detail": "JEXL function",
"documentation": "Decodes a Base64 encoded string.\n\n**Examples:**\n`base64Decode(\"aGVsbG8=\") // \"hello\"`\n`\"aGVsbG8gd29ybGQ=\"|base64Decode // \"hello world\"`\n`base64Decode(\"dGVzdA==\") // \"test\"`\n\n**Parameters:**\n- `input` (unknown): The Base64 encoded string to decode.\n\n**Returns:** The decoded string, or empty string if input is not a string.",
"examples": [
"base64Decode(\"aGVsbG8=\") // \"hello\"",
"\"aGVsbG8gd29ybGQ=\"|base64Decode // \"hello world\"",
"base64Decode(\"dGVzdA==\") // \"test\""
],
"parameters": [
{
"name": "input",
"description": "The Base64 encoded string to decode.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The decoded string, or empty string if input is not a string."
},
"insertText": "base64Decode(${1:input})"
},
{
"type": "function",
"name": "base64Encode",
"label": "base64Encode",
"description": "Encodes a string to Base64.",
"detail": "JEXL function",
"documentation": "Encodes a string to Base64.\n\n**Examples:**\n`base64Encode(\"hello\") // \"aGVsbG8=\"`\n`\"hello world\"|base64Encode // \"aGVsbG8gd29ybGQ=\"`\n`base64Encode(\"test\") // \"dGVzdA==\"`\n\n**Parameters:**\n- `input` (unknown): The input string to encode.\n\n**Returns:** The Base64 encoded string, or empty string if input is not a string or encoding fails.",
"examples": [
"base64Encode(\"hello\") // \"aGVsbG8=\"",
"\"hello world\"|base64Encode // \"aGVsbG8gd29ybGQ=\"",
"base64Encode(\"test\") // \"dGVzdA==\""
],
"parameters": [
{
"name": "input",
"description": "The input string to encode.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The Base64 encoded string, or empty string if input is not a string or encoding fails."
},
"insertText": "base64Encode(${1:input})"
},
{
"type": "function",
"name": "toBoolean",
"label": "boolean",
"description": "Converts the input to a boolean.",
"detail": "JEXL function",
"documentation": "Converts the input to a boolean.\n\n**Examples:**\n`toBoolean(\"true\") // true`\n`\"false\"|toBoolean // false`\n`toBoolean(1) // true`\n\n**Parameters:**\n- `input` (unknown): The input to convert to a boolean.\n\n**Returns:** The boolean value, or undefined for ambiguous string values.",
"examples": [
"toBoolean(\"true\") // true",
"\"false\"|toBoolean // false",
"toBoolean(1) // true"
],
"parameters": [
{
"name": "input",
"description": "The input to convert to a boolean.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "boolean",
"description": "The boolean value, or undefined for ambiguous string values."
},
"insertText": "boolean(${1:input})",
"aliases": [
"toBoolean",
"bool"
]
},
{
"type": "function",
"name": "camelCase",
"label": "camelCase",
"description": "Converts the input string to camel case.",
"detail": "JEXL function",
"documentation": "Converts the input string to camel case.\n\n**Examples:**\n`camelCase(\"foo bar\") // \"fooBar\"`\n`\"hello-world\"|camelCase // \"helloWorld\"`\n`camelCase(\"HELLO_WORLD\") // \"helloWorld\"`\n\n**Parameters:**\n- `input` (unknown): The input string to convert to camel case.\n\n**Returns:** The camel case string, or empty string if input is not a string.",
"examples": [
"camelCase(\"foo bar\") // \"fooBar\"",
"\"hello-world\"|camelCase // \"helloWorld\"",
"camelCase(\"HELLO_WORLD\") // \"helloWorld\""
],
"parameters": [
{
"name": "input",
"description": "The input string to convert to camel case.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The camel case string, or empty string if input is not a string."
},
"insertText": "camelCase(${1:input})"
},
{
"type": "function",
"name": "switchCase",
"label": "case",
"description": "Evaluates a list of predicates and returns the first result expression whose predicate is satisfied.",
"detail": "JEXL function",
"documentation": "Evaluates a list of predicates and returns the first result expression whose predicate is satisfied.\n\n**Examples:**\n`switch(expression, case1, result1, case2, result2, ..., default)`\n\n**Parameters:**\n- `args` (array): The arguments array where the first element is the expression to evaluate, followed by pairs of case and result, and optionally a default value.\n\n**Returns:** The result of the first case whose predicate is satisfied, or the default value if no case is satisfied.",
"examples": [
"switch(expression, case1, result1, case2, result2, ..., default)"
],
"parameters": [
{
"name": "args",
"description": "The arguments array where the first element is the expression to evaluate, followed by pairs of case and result, and optionally a default value.",
"type": "array",
"optional": false
}
],
"returns": {
"type": "unknown",
"description": "The result of the first case whose predicate is satisfied, or the default value if no case is satisfied."
},
"insertText": "case(${1:args})",
"aliases": [
"switchCase",
"switch"
]
},
{
"type": "function",
"name": "ceil",
"label": "ceil",
"description": "Rounds a number up to the nearest integer.",
"detail": "JEXL function",
"documentation": "Rounds a number up to the nearest integer.\n\n**Examples:**\n`ceil(3.2) // 4`\n`(3.14)|ceil // 4`\n`ceil(-2.8) // -2`\n\n**Parameters:**\n- `input` (unknown): The input number to round up.\n\n**Returns:** The rounded up integer, or NaN if input cannot be converted to a number.",
"examples": [
"ceil(3.2) // 4",
"(3.14)|ceil // 4",
"ceil(-2.8) // -2"
],
"parameters": [
{
"name": "input",
"description": "The input number to round up.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The rounded up integer, or NaN if input cannot be converted to a number."
},
"insertText": "ceil(${1:input})"
},
{
"type": "function",
"name": "contains",
"label": "contains",
"description": "Checks if the input string or array contains the specified value.",
"detail": "JEXL function",
"documentation": "Checks if the input string or array contains the specified value.\n\n**Examples:**\n`contains(\"hello world\", \"world\") // true`\n`\"foo-bar\"|contains(\"bar\") // true`\n`contains([1, 2, 3], 2) // true`\n\n**Parameters:**\n- `input` (unknown): The input string or array to search in.\n- `search` (string): The value to search for.\n\n**Returns:** True if the input contains the search value, false otherwise.",
"examples": [
"contains(\"hello world\", \"world\") // true",
"\"foo-bar\"|contains(\"bar\") // true",
"contains([1, 2, 3], 2) // true"
],
"parameters": [
{
"name": "input",
"description": "The input string or array to search in.",
"type": "unknown",
"optional": false
},
{
"name": "search",
"description": "The value to search for.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "boolean",
"description": "True if the input contains the search value, false otherwise."
},
"insertText": "contains(${1:input}, ${2:search})",
"aliases": [
"includes"
]
},
{
"type": "function",
"name": "convertTimeZone",
"label": "convertTimeZone",
"description": "Converts an ISO datetime string to a target timezone, handling daylight savings, and returns an ISO string with the correct offset.",
"detail": "JEXL function",
"documentation": "Converts an ISO datetime string to a target timezone, handling daylight savings, and returns an ISO string with the correct offset.\n\n**Examples:**\n`convertTimeZone('2025-06-26T12:00:00Z', 'Europe/Amsterdam') // 2025-06-26T14:00:00.0000000+02:00`\n`'2025-06-26T12:00:00Z'|convertTimeZone('Pacific Standard Time') // '2025-06-26T05:00:00.0000000-07:00'`\n\n**Parameters:**\n- `input` (unknown): ISO datetime string\n- `targetTimeZone` (unknown): Target timezone (IANA or Windows ID or fixed offset)\n\n**Returns:** ISO datetime string with correct offset",
"examples": [
"convertTimeZone('2025-06-26T12:00:00Z', 'Europe/Amsterdam') // 2025-06-26T14:00:00.0000000+02:00",
"'2025-06-26T12:00:00Z'|convertTimeZone('Pacific Standard Time') // '2025-06-26T05:00:00.0000000-07:00'"
],
"parameters": [
{
"name": "input",
"description": "ISO datetime string",
"type": "unknown",
"optional": false
},
{
"name": "targetTimeZone",
"description": "Target timezone (IANA or Windows ID or fixed offset)",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "string",
"description": "ISO datetime string with correct offset"
},
"insertText": "convertTimeZone(${1:input}, ${2:targetTimeZone})"
},
{
"type": "function",
"name": "dateTimeAdd",
"label": "dateTimeAdd",
"description": "Adds a time range to a date and time in the ISO 8601 format.",
"detail": "JEXL function",
"documentation": "Adds a time range to a date and time in the ISO 8601 format.\n\n**Examples:**\n`dateTimeAdd(\"2023-12-25T10:30:00.000Z\", \"day\", 1) // \"2023-12-26T10:30:00.000Z\"`\n`now()|dateTimeAdd(\"hour\", -2) // Two hours ago`\n`dateTimeAdd(\"2023-01-01T00:00:00.000Z\", \"month\", 3) // \"2023-04-01T00:00:00.000Z\"`\n\n**Parameters:**\n- `input` (string): The input date and time string in ISO 8601 format.\n- `unit` (string): The time unit to add (\"day\", \"hour\", \"minute\", \"second\", \"month\", \"year\", etc.).\n- `value` (number): The amount to add (can be negative to subtract).\n\n**Returns:** The new date and time as an ISO 8601 string.",
"examples": [
"dateTimeAdd(\"2023-12-25T10:30:00.000Z\", \"day\", 1) // \"2023-12-26T10:30:00.000Z\"",
"now()|dateTimeAdd(\"hour\", -2) // Two hours ago",
"dateTimeAdd(\"2023-01-01T00:00:00.000Z\", \"month\", 3) // \"2023-04-01T00:00:00.000Z\""
],
"parameters": [
{
"name": "input",
"description": "The input date and time string in ISO 8601 format.",
"type": "string",
"optional": false
},
{
"name": "unit",
"description": "The time unit to add (\"day\", \"hour\", \"minute\", \"second\", \"month\", \"year\", etc.).",
"type": "string",
"optional": false
},
{
"name": "value",
"description": "The amount to add (can be negative to subtract).",
"type": "number",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The new date and time as an ISO 8601 string."
},
"insertText": "dateTimeAdd(${1:input}, ${2:unit}, ${3:value})"
},
{
"type": "function",
"name": "dateTimeFormat",
"label": "dateTimeFormat",
"description": "Converts a date and time to a provided format.",
"detail": "JEXL function",
"documentation": "Converts a date and time to a provided format.\n\n**Examples:**\n`dateTimeFormat(datetime, format)`\n`datetime|dateTimeFormat(format)`\n\n**Parameters:**\n- `input` (union): The input date and time, either as a string or number.\n- `format` (string): The format to convert the date and time to.\n\n**Returns:** The date and time in the specified format.",
"examples": [
"dateTimeFormat(datetime, format)",
"datetime|dateTimeFormat(format)"
],
"parameters": [
{
"name": "input",
"description": "The input date and time, either as a string or number.",
"type": "union",
"optional": false
},
{
"name": "format",
"description": "The format to convert the date and time to.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The date and time in the specified format."
},
"insertText": "dateTimeFormat(${1:input}, ${2:format})"
},
{
"type": "function",
"name": "dateTimeToMillis",
"label": "dateTimeToMillis",
"description": "Parses the date and time in the ISO 8601 format and returns the number of milliseconds since the Unix epoch.",
"detail": "JEXL function",
"documentation": "Parses the date and time in the ISO 8601 format and returns the number of milliseconds since the Unix epoch.\n\n**Examples:**\n`dateTimeToMillis(\"2023-12-25T10:30:00.000Z\") // 1703505000000`\n`\"2023-01-01T00:00:00.000Z\"|dateTimeToMillis // 1672531200000`\n`dateTimeToMillis(\"2023-12-25\") // 1703462400000`\n\n**Parameters:**\n- `input` (string): The date and time string to parse.\n\n**Returns:** The timestamp in milliseconds since Unix epoch.",
"examples": [
"dateTimeToMillis(\"2023-12-25T10:30:00.000Z\") // 1703505000000",
"\"2023-01-01T00:00:00.000Z\"|dateTimeToMillis // 1672531200000",
"dateTimeToMillis(\"2023-12-25\") // 1703462400000"
],
"parameters": [
{
"name": "input",
"description": "The date and time string to parse.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The timestamp in milliseconds since Unix epoch."
},
"insertText": "dateTimeToMillis(${1:input})",
"aliases": [
"toMillis"
]
},
{
"type": "function",
"name": "arrayDistinct",
"label": "distinct",
"description": "Returns a new array with duplicate elements removed.",
"detail": "JEXL function",
"documentation": "Returns a new array with duplicate elements removed.\n\n**Examples:**\n`distinct([1, 2, 2, 3, 1]) // [1, 2, 3]`\n`[1, 2, 2, 3]|distinct // [1, 2, 3]`\n`distinct([\"a\", \"b\", \"a\", \"c\"]) // [\"a\", \"b\", \"c\"]`\n\n**Parameters:**\n- `input` (array): The input array to remove duplicates from.\n\n**Returns:** A new array with duplicates removed, or empty array if input is not an array.",
"examples": [
"distinct([1, 2, 2, 3, 1]) // [1, 2, 3]",
"[1, 2, 2, 3]|distinct // [1, 2, 3]",
"distinct([\"a\", \"b\", \"a\", \"c\"]) // [\"a\", \"b\", \"c\"]"
],
"parameters": [
{
"name": "input",
"description": "The input array to remove duplicates from.",
"type": "array",
"optional": false
}
],
"returns": {
"type": "array",
"description": "A new array with duplicates removed, or empty array if input is not an array."
},
"insertText": "distinct(${1:input})",
"aliases": [
"arrayDistinct"
]
},
{
"type": "function",
"name": "endsWith",
"label": "endsWith",
"description": "Checks if the input string ends with the specified substring.",
"detail": "JEXL function",
"documentation": "Checks if the input string ends with the specified substring.\n\n**Examples:**\n`endsWith(\"hello world\", \"world\") // true`\n`\"foo-bar\"|endsWith(\"bar\") // true`\n`endsWith(\"test\", \"xyz\") // false`\n\n**Parameters:**\n- `input` (unknown): The input string to check.\n- `search` (string): The substring to search for at the end.\n\n**Returns:** True if the input ends with the search string, false otherwise.",
"examples": [
"endsWith(\"hello world\", \"world\") // true",
"\"foo-bar\"|endsWith(\"bar\") // true",
"endsWith(\"test\", \"xyz\") // false"
],
"parameters": [
{
"name": "input",
"description": "The input string to check.",
"type": "unknown",
"optional": false
},
{
"name": "search",
"description": "The substring to search for at the end.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "boolean",
"description": "True if the input ends with the search string, false otherwise."
},
"insertText": "endsWith(${1:input}, ${2:search})"
},
{
"type": "function",
"name": "objectEntries",
"label": "entries",
"description": "Returns an array of key-value pairs from the input object.",
"detail": "JEXL function",
"documentation": "Returns an array of key-value pairs from the input object.\n\n**Examples:**\n`entries({name: \"John\", age: 30}) // [[\"name\", \"John\"], [\"age\", 30]]`\n`{a: 1, b: 2}|entries // [[\"a\", 1], [\"b\", 2]]`\n`entries({}) // []`\n\n**Parameters:**\n- `input` (unknown): The input object to get entries from.\n\n**Returns:** An array of [key, value] pairs, or undefined if input is not an object.",
"examples": [
"entries({name: \"John\", age: 30}) // [[\"name\", \"John\"], [\"age\", 30]]",
"{a: 1, b: 2}|entries // [[\"a\", 1], [\"b\", 2]]",
"entries({}) // []"
],
"parameters": [
{
"name": "input",
"description": "The input object to get entries from.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "array",
"description": "An array of [key, value] pairs, or undefined if input is not an object."
},
"insertText": "entries(${1:input})",
"aliases": [
"objectEntries"
]
},
{
"type": "function",
"name": "_eval",
"label": "eval",
"description": "Evaluates a JEXL expression and returns the result.",
"detail": "JEXL function",
"documentation": "Evaluates a JEXL expression and returns the result.\nIf only one argument is provided, it is expected that the first argument is a JEXL expression.\nIf two arguments are provided, the first argument is the context (must be an object) and the second argument is the JEXL expression.\nThe expression uses the default JEXL extended grammar and can't use any custom defined functions or transforms.\n\n**Examples:**\n`_eval(\"1 + 2\") // 3`\n`_eval({x: 5, y: 10}, \"x + y\") // 15`\n`\"2 * 3\"|_eval // 6`\n\n**Parameters:**\n- `input` (unknown): Either a JEXL expression string or a context object.\n- `expression` (string): Optional JEXL expression when first argument is context.\n\n**Returns:** The result of evaluating the expression, or undefined if evaluation fails.",
"examples": [
"_eval(\"1 + 2\") // 3",
"_eval({x: 5, y: 10}, \"x + y\") // 15",
"\"2 * 3\"|_eval // 6"
],
"parameters": [
{
"name": "input",
"description": "Either a JEXL expression string or a context object.",
"type": "unknown",
"optional": false
},
{
"name": "expression",
"description": "Optional JEXL expression when first argument is context.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "any",
"description": "The result of evaluating the expression, or undefined if evaluation fails."
},
"insertText": "eval(${1:input}, ${2:expression})",
"aliases": [
"_eval"
]
},
{
"type": "function",
"name": "arrayFilter",
"label": "filter",
"description": "Returns a new array with the elements of the input array that match the specified expression.",
"detail": "JEXL function",
"documentation": "Returns a new array with the elements of the input array that match the specified expression.\nThe expression must be a valid JEXL expression string, and is applied to each element of the array.\nThe relative context provided to the expression is an object with the properties value, index and array (the original array).\n\n**Examples:**\n`filter([1, 2, 3, 4], \"value > 2\") // [3, 4]`\n`[{age: 25}, {age: 35}]|filter(\"value.age > 30\") // [{age: 35}]`\n`filter([1, 2, 3, 4], \"value % 2 == 0\") // [2, 4]`\n\n**Parameters:**\n- `input` (array): The input array to filter.\n- `expression` (string): The JEXL expression to test against each element (supports value, index and array as context).\n\n**Returns:** A new array containing only elements that match the expression, or empty array if input is not an array.",
"examples": [
"filter([1, 2, 3, 4], \"value > 2\") // [3, 4]",
"[{age: 25}, {age: 35}]|filter(\"value.age > 30\") // [{age: 35}]",
"filter([1, 2, 3, 4], \"value % 2 == 0\") // [2, 4]"
],
"parameters": [
{
"name": "input",
"description": "The input array to filter.",
"type": "array",
"optional": false
},
{
"name": "expression",
"description": "The JEXL expression to test against each element (supports value, index and array as context).",
"type": "string",
"optional": false
}
],
"returns": {
"type": "array",
"description": "A new array containing only elements that match the expression, or empty array if input is not an array."
},
"insertText": "filter(${1:input}, ${2:expression})",
"aliases": [
"arrayFilter"
]
},
{
"type": "function",
"name": "arrayFind",
"label": "find",
"description": "Finds the first element in an array that matches the specified expression.",
"detail": "JEXL function",
"documentation": "Finds the first element in an array that matches the specified expression.\nThe expression must be a valid JEXL expression string, and is applied to each element of the array.\nThe relative context provided to the expression is an object with the properties value, index and array (the original array).\n\n**Examples:**\n`find([1, 2, 3, 4], \"value > 2\") // 3`\n`[{name: \"John\"}, {name: \"Jane\"}]|find(\"value.name == 'Jane'\") // {name: \"Jane\"}`\n`find([1, 2, 3], \"value > 5\") // undefined`\n\n**Parameters:**\n- `input` (array): The input array to search.\n- `expression` (string): The JEXL expression to test against each element (supports value, index and array as context).\n\n**Returns:** The first element that matches the expression, or undefined if no match found or input is not an array.",
"examples": [
"find([1, 2, 3, 4], \"value > 2\") // 3",
"[{name: \"John\"}, {name: \"Jane\"}]|find(\"value.name == 'Jane'\") // {name: \"Jane\"}",
"find([1, 2, 3], \"value > 5\") // undefined"
],
"parameters": [
{
"name": "input",
"description": "The input array to search.",
"type": "array",
"optional": false
},
{
"name": "expression",
"description": "The JEXL expression to test against each element (supports value, index and array as context).",
"type": "string",
"optional": false
}
],
"returns": {
"type": "unknown",
"description": "The first element that matches the expression, or undefined if no match found or input is not an array."
},
"insertText": "find(${1:input}, ${2:expression})",
"aliases": [
"arrayFind"
]
},
{
"type": "function",
"name": "arrayFindIndex",
"label": "findIndex",
"description": "Finds the index of the first element in the input array that satisfies the given Jexl expression.",
"detail": "JEXL function",
"documentation": "Finds the index of the first element in the input array that satisfies the given Jexl expression.\n\n**Examples:**\n`[1, 2, 3, 4]|findIndex('value > 2'); // returns 2`\n\n**Parameters:**\n- `input` (array): The array to search through.\n- `expression` (string): A Jexl expression string to evaluate for each element. The expression has access to \n\n**Returns:** The index of the first matching element, or ",
"examples": [
"[1, 2, 3, 4]|findIndex('value > 2'); // returns 2"
],
"parameters": [
{
"name": "input",
"description": "The array to search through.",
"type": "array",
"optional": false
},
{
"name": "expression",
"description": "A Jexl expression string to evaluate for each element. The expression has access to ",
"type": "string",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The index of the first matching element, or "
},
"insertText": "findIndex(${1:input}, ${2:expression})",
"aliases": [
"arrayFindIndex"
]
},
{
"type": "function",
"name": "floor",
"label": "floor",
"description": "Rounds a number down to the nearest integer.",
"detail": "JEXL function",
"documentation": "Rounds a number down to the nearest integer.\n\n**Examples:**\n`floor(3.7) // 3`\n`(3.14)|floor // 3`\n`floor(-2.8) // -3`\n\n**Parameters:**\n- `input` (unknown): The input number to round down.\n\n**Returns:** The rounded down integer, or NaN if input cannot be converted to a number.",
"examples": [
"floor(3.7) // 3",
"(3.14)|floor // 3",
"floor(-2.8) // -3"
],
"parameters": [
{
"name": "input",
"description": "The input number to round down.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The rounded down integer, or NaN if input cannot be converted to a number."
},
"insertText": "floor(${1:input})"
},
{
"type": "function",
"name": "formatBase",
"label": "formatBase",
"description": "Formats a number as a string in the specified base.",
"detail": "JEXL function",
"documentation": "Formats a number as a string in the specified base.\n\n**Examples:**\n`formatBase(255, 16) // \"ff\"`\n`(10)|formatBase(2) // \"1010\"`\n`formatBase(64, 8) // \"100\"`\n\n**Parameters:**\n- `input` (unknown): The input number to format.\n- `base` (number): The numeric base to convert to (2-36).\n\n**Returns:** The number formatted in the specified base, or empty string if input cannot be converted to a number.",
"examples": [
"formatBase(255, 16) // \"ff\"",
"(10)|formatBase(2) // \"1010\"",
"formatBase(64, 8) // \"100\""
],
"parameters": [
{
"name": "input",
"description": "The input number to format.",
"type": "unknown",
"optional": false
},
{
"name": "base",
"description": "The numeric base to convert to (2-36).",
"type": "number",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The number formatted in the specified base, or empty string if input cannot be converted to a number."
},
"insertText": "formatBase(${1:input}, ${2:base})"
},
{
"type": "function",
"name": "formatInteger",
"label": "formatInteger",
"description": "Formats a number as an integer with zero padding.",
"detail": "JEXL function",
"documentation": "Formats a number as an integer with zero padding.\n\n**Examples:**\n`formatInteger(42, \"000\") // \"042\"`\n`(7)|formatInteger(\"0000\") // \"0007\"`\n`formatInteger(123, \"00\") // \"123\"`\n\n**Parameters:**\n- `input` (unknown): The input number to format.\n- `format` (string): The format string indicating the minimum number of digits.\n\n**Returns:** The zero-padded integer string, or empty string if input cannot be converted to a number.",
"examples": [
"formatInteger(42, \"000\") // \"042\"",
"(7)|formatInteger(\"0000\") // \"0007\"",
"formatInteger(123, \"00\") // \"123\""
],
"parameters": [
{
"name": "input",
"description": "The input number to format.",
"type": "unknown",
"optional": false
},
{
"name": "format",
"description": "The format string indicating the minimum number of digits.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The zero-padded integer string, or empty string if input cannot be converted to a number."
},
"insertText": "formatInteger(${1:input}, ${2:format})"
},
{
"type": "function",
"name": "formatNumber",
"label": "formatNumber",
"description": "Formats a number to a decimal representation as specified by the format string.",
"detail": "JEXL function",
"documentation": "Formats a number to a decimal representation as specified by the format string.\n\n**Examples:**\n`formatNumber(1234.567, \"#,##0.00\") // \"1,234.57\"`\n`(1000)|formatNumber(\"0.00\") // \"1000.00\"`\n`formatNumber(42, \"#,###\") // \"42\"`\n\n**Parameters:**\n- `input` (unknown): The input number to format.\n- `format` (string): The format string specifying decimal places and grouping.\n\n**Returns:** The formatted number string, or empty string if input cannot be converted to a number.",
"examples": [
"formatNumber(1234.567, \"#,##0.00\") // \"1,234.57\"",
"(1000)|formatNumber(\"0.00\") // \"1000.00\"",
"formatNumber(42, \"#,###\") // \"42\""
],
"parameters": [
{
"name": "input",
"description": "The input number to format.",
"type": "unknown",
"optional": false
},
{
"name": "format",
"description": "The format string specifying decimal places and grouping.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The formatted number string, or empty string if input cannot be converted to a number."
},
"insertText": "formatNumber(${1:input}, ${2:format})"
},
{
"type": "function",
"name": "formUrlEncoded",
"label": "formUrlEncoded",
"description": "Encodes a string or object to URI component format.",
"detail": "JEXL function",
"documentation": "Encodes a string or object to URI component format.\n\n**Examples:**\n`formUrlEncoded(\"hello world\") // \"hello%20world\"`\n`formUrlEncoded({name: \"John\", age: 30}) // \"name=John&age=30\"`\n`\"hello & world\"|formUrlEncoded // \"hello%20%26%20world\"`\n\n**Parameters:**\n- `input` (unknown): The input string or object to encode.\n\n**Returns:** The URL encoded string, or empty string if input is not a string or object.",
"examples": [
"formUrlEncoded(\"hello world\") // \"hello%20world\"",
"formUrlEncoded({name: \"John\", age: 30}) // \"name=John&age=30\"",
"\"hello & world\"|formUrlEncoded // \"hello%20%26%20world\""
],
"parameters": [
{
"name": "input",
"description": "The input string or object to encode.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "string",
"description": "The URL encoded string, or empty string if input is not a string or object."
},
"insertText": "formUrlEncoded(${1:input})"
},
{
"type": "function",
"name": "arrayJoin",
"label": "join",
"description": "Joins elements of an array into a string.",
"detail": "JEXL function",
"documentation": "Joins elements of an array into a string.\n\n**Examples:**\n`arrayJoin([\"foo\", \"bar\", \"baz\"], \",\") // \"foo,bar,baz\"`\n`[\"one\", \"two\", \"three\"]|arrayJoin(\"-\") // \"one-two-three\"`\n`arrayJoin([1, 2, 3]) // \"1,2,3\"`\n\n**Parameters:**\n- `input` (unknown): The input array to join.\n- `separator` (string?): The separator string to use between elements. Defaults to comma.\n\n**Returns:** The joined string, or undefined if input is not an array.",
"examples": [
"arrayJoin([\"foo\", \"bar\", \"baz\"], \",\") // \"foo,bar,baz\"",
"[\"one\", \"two\", \"three\"]|arrayJoin(\"-\") // \"one-two-three\"",
"arrayJoin([1, 2, 3]) // \"1,2,3\""
],
"parameters": [
{
"name": "input",
"description": "The input array to join.",
"type": "unknown",
"optional": false
},
{
"name": "separator",
"description": "The separator string to use between elements. Defaults to comma.",
"type": "string",
"optional": true
}
],
"returns": {
"type": "string",
"description": "The joined string, or undefined if input is not an array."
},
"insertText": "join(${1:input}, ${2:separator?})",
"aliases": [
"arrayJoin"
]
},
{
"type": "function",
"name": "toJson",
"label": "json",
"description": "Parses the string and returns a JSON object.",
"detail": "JEXL function",
"documentation": "Parses the string and returns a JSON object.\n\n**Examples:**\n`toJson('{\"key\": \"value\"}') // { key: \"value\" }`\n`'{\"name\": \"John\", \"age\": 30}'|toJson // { name: \"John\", age: 30 }`\n\n**Parameters:**\n- `input` (string): The JSON string to parse.\n\n**Returns:** The parsed JSON object or value.",
"examples": [
"toJson('{\"key\": \"value\"}') // { key: \"value\" }",
"'{\"name\": \"John\", \"age\": 30}'|toJson // { name: \"John\", age: 30 }"
],
"parameters": [
{
"name": "input",
"description": "The JSON string to parse.",
"type": "string",
"optional": false
}
],
"returns": {
"type": "any",
"description": "The parsed JSON object or value."
},
"insertText": "json(${1:input})",
"aliases": [
"toJson",
"parseJson"
]
},
{
"type": "function",
"name": "objectKeys",
"label": "keys",
"description": "Returns the keys of an object as an array.",
"detail": "JEXL function",
"documentation": "Returns the keys of an object as an array.\n\n**Examples:**\n`keys({name: \"John\", age: 30}) // [\"name\", \"age\"]`\n`{a: 1, b: 2}|keys // [\"a\", \"b\"]`\n`keys({}) // []`\n\n**Parameters:**\n- `input` (unknown): The input object to get keys from.\n\n**Returns:** An array of object keys, or undefined if input is not an object.",
"examples": [
"keys({name: \"John\", age: 30}) // [\"name\", \"age\"]",
"{a: 1, b: 2}|keys // [\"a\", \"b\"]",
"keys({}) // []"
],
"parameters": [
{
"name": "input",
"description": "The input object to get keys from.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "array",
"description": "An array of object keys, or undefined if input is not an object."
},
"insertText": "keys(${1:input})",
"aliases": [
"objectKeys"
]
},
{
"type": "function",
"name": "length",
"label": "length",
"description": "Returns the number of characters in a string, or the length of an array.",
"detail": "JEXL function",
"documentation": "Returns the number of characters in a string, or the length of an array.\n\n**Examples:**\n`length(\"hello\") // 5`\n`length([1, 2, 3]) // 3`\n\n**Parameters:**\n- `input` (unknown): The input can be a string, an array, or an object.\n\n**Returns:** The number of characters in a string, or the length of an array.",
"examples": [
"length(\"hello\") // 5",
"length([1, 2, 3]) // 3"
],
"parameters": [
{
"name": "input",
"description": "The input can be a string, an array, or an object.",
"type": "unknown",
"optional": false
}
],
"returns": {
"type": "number",
"description": "The number of characters in a string, or the length of an array."
},
"insertText": "length(${1:input})",
"aliases": [
"count",
"size"
]
},
{
"type": "function",
"name": "localTimeToIsoWithOffset",
"label": "localTimeToIsoWithOffset",
"description": "Converts a local time string in a specified timezone to an ISO datetime string with the correct offset.",
"detail": "JEXL function",
"documentation": "Converts a local time string in a specified timezone to an ISO datetime string with the correct offset.\n\n**Examples:**\n`localTimeToIsoWithOffset('2025-06-26 14:00:00', 'Europe/Amsterdam') // '2025-06-26T14:00:00.0000000+02:00'`\n`'2025-06-26 05:00:00'|localTimeToIsoWithOffset('Pacific Standard Time') // '2025-06-26T05:00:00.0000000-08:00'`\n\n**Parameters:**\n- `localTime` (string): Local time string\n- `timeZone` (string): Timezone (IANA or Windows ID or fixed offset)\n\n**Returns:** ISO datetime string with correct offset",
"examples": [
"localTimeToIsoWithOffset('2025-06-26 14:00:00', 'Europe/Amsterdam') // '2025-06-26T14:00:00.0000000+02:00'",
"'2025-06-26 05:00:00'|localTimeToIsoWithOffset('Pacific Standard Time') // '2025-06-26T05:00:00.0000000-08:00'"
],
"parameters": [
{
"name": "localTime",
"description": "Local time string",
"type": "string",
"optional": false
},
{
"name": "timeZone",
"description": "Timezone (IANA or Windows ID or fixed offset)",
"type": "string",
"optional": false
}
],
"returns": {
"type": "string",
"description": "ISO datetime string with correct offset"
},
"insertText": "localTimeToIsoWithOffset(${1:localTime}, ${2:timeZone})"