mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Add missing documentation to autocomplete items for inline code editor (#5560)
* ⚡ Added documentation for extension functions with arguments * ⚡ Adding custom autocomplete item types. This enables us to show different items with same labels. * 📚 Adding missing info for extensions autocomplete items * ⚡ Added Luxon autocomplete docs * 💡 Completing Luxon static methods autocomplete documentation * ⚡ Refactoring Luxon autocomplete logic * ⚡ Handling the case when autocomplete item doesn't have defined inline documentation * ⚡ Added correct doc info to Luxon instance properties * ✨ Added missing documentation and notice footer for autocomplete popup. * 👕 Fixing lint error * ✔️ Removing `Object.hasOwn` function, since it's not supported in node v14
This commit is contained in:
committed by
GitHub
parent
bb4db58819
commit
ae634407a4
@@ -323,120 +323,193 @@ function intersection(value: unknown[], extraArgs: unknown[][]): unknown[] {
|
||||
|
||||
average.doc = {
|
||||
name: 'average',
|
||||
description: 'Returns the mean average of all values in the array',
|
||||
description: 'Returns the mean average of all values in the array.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-average',
|
||||
};
|
||||
|
||||
compact.doc = {
|
||||
name: 'compact',
|
||||
description: 'Removes all empty values from the array',
|
||||
returnType: 'array',
|
||||
description: 'Removes all empty values from the array.',
|
||||
returnType: 'Array',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-compact',
|
||||
};
|
||||
|
||||
isEmpty.doc = {
|
||||
name: 'isEmpty',
|
||||
description: 'Checks if the array doesn’t have any elements',
|
||||
description: 'Checks if the array doesn’t have any elements.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-isEmpty',
|
||||
};
|
||||
|
||||
isNotEmpty.doc = {
|
||||
name: 'isNotEmpty',
|
||||
description: 'Checks if the array has elements',
|
||||
description: 'Checks if the array has elements.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-isNotEmpty',
|
||||
};
|
||||
|
||||
first.doc = {
|
||||
name: 'first',
|
||||
description: 'Returns the first element of the array',
|
||||
returnType: 'array item',
|
||||
description: 'Returns the first element of the array.',
|
||||
returnType: 'Element',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-first',
|
||||
};
|
||||
|
||||
last.doc = {
|
||||
name: 'last',
|
||||
description: 'Returns the last element of the array',
|
||||
returnType: 'array item',
|
||||
description: 'Returns the last element of the array.',
|
||||
returnType: 'Element',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-last',
|
||||
};
|
||||
|
||||
max.doc = {
|
||||
name: 'max',
|
||||
description: 'Gets the maximum value from a number-only array',
|
||||
description: 'Gets the maximum value from a number-only array.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-max',
|
||||
};
|
||||
|
||||
min.doc = {
|
||||
name: 'min',
|
||||
description: 'Gets the minimum value from a number-only array',
|
||||
description: 'Gets the minimum value from a number-only array.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-min',
|
||||
};
|
||||
|
||||
randomItem.doc = {
|
||||
name: 'randomItem',
|
||||
description: 'Returns a random element from an array',
|
||||
returnType: 'number',
|
||||
description: 'Returns a random element from an array.',
|
||||
returnType: 'Element',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-randomItem',
|
||||
};
|
||||
|
||||
sum.doc = {
|
||||
name: 'sum',
|
||||
description: 'Returns the total sum all the values in an array of parsable numbers',
|
||||
description: 'Returns the total sum all the values in an array of parsable numbers.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-sum',
|
||||
};
|
||||
|
||||
// @TODO_NEXT_PHASE: Surface extensions below which take args
|
||||
|
||||
chunk.doc = {
|
||||
name: 'chunk',
|
||||
returnType: 'array',
|
||||
description: 'Splits arrays into chunks with a length of `size`.',
|
||||
returnType: 'Array',
|
||||
args: [{ name: 'size', type: 'number' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-chunk',
|
||||
};
|
||||
|
||||
difference.doc = {
|
||||
name: 'difference',
|
||||
returnType: 'array',
|
||||
description:
|
||||
'Compares two arrays. Returns all elements in the base array that aren’t present in `arr`.',
|
||||
returnType: 'Array',
|
||||
args: [{ name: 'arr', type: 'Array' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-difference',
|
||||
};
|
||||
|
||||
intersection.doc = {
|
||||
name: 'intersection',
|
||||
returnType: 'array',
|
||||
description:
|
||||
'Compares two arrays. Returns all elements in the base array that are present in `arr`.',
|
||||
returnType: 'Array',
|
||||
args: [{ name: 'arr', type: 'Array' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-intersection',
|
||||
};
|
||||
|
||||
merge.doc = {
|
||||
name: 'merge',
|
||||
description:
|
||||
'Merges two Object-arrays into one array by merging the key-value pairs of each element.',
|
||||
returnType: 'array',
|
||||
args: [{ name: 'arr', type: 'Array' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-merge',
|
||||
};
|
||||
|
||||
pluck.doc = {
|
||||
name: 'pluck',
|
||||
returnType: 'array',
|
||||
description: 'Returns an array of Objects where the key is equal the given `fieldName`s.',
|
||||
returnType: 'Array',
|
||||
args: [
|
||||
{ name: 'fieldName1', type: 'string' },
|
||||
{ name: 'fieldName1?', type: 'string' },
|
||||
{ name: '...' },
|
||||
{ name: 'fieldNameN?', type: 'string' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-pluck',
|
||||
};
|
||||
|
||||
renameKeys.doc = {
|
||||
name: 'renameKeys',
|
||||
returnType: 'array',
|
||||
description: 'Renames all matching keys in the array.',
|
||||
returnType: 'Array',
|
||||
args: [
|
||||
{ name: 'from1', type: 'string' },
|
||||
{ name: 'to1', type: 'string' },
|
||||
{ name: 'from2?', type: 'string' },
|
||||
{ name: 'to2?', type: 'string' },
|
||||
{ name: '...' },
|
||||
{ name: 'fromN?', type: 'string' },
|
||||
{ name: 'toN?', type: 'string' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-renameKeys',
|
||||
};
|
||||
|
||||
smartJoin.doc = {
|
||||
name: 'smartJoin',
|
||||
returnType: 'array',
|
||||
description:
|
||||
'Operates on an array of objects where each object contains key-value pairs. Creates a new object containing key-value pairs, where the key is the value of the first pair, and the value is the value of the second pair. Removes non-matching and empty values and trims any whitespace before joining.',
|
||||
returnType: 'Array',
|
||||
args: [
|
||||
{ name: 'keyField', type: 'string' },
|
||||
{ name: 'nameField', type: 'string' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-smartJoin',
|
||||
};
|
||||
|
||||
union.doc = {
|
||||
name: 'union',
|
||||
returnType: 'array',
|
||||
description: 'Concatenates two arrays and then removes duplicates.',
|
||||
returnType: 'Array',
|
||||
args: [{ name: 'arr', type: 'Array' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-union',
|
||||
};
|
||||
|
||||
unique.doc = {
|
||||
name: 'unique',
|
||||
returnType: 'array item',
|
||||
description: 'Remove duplicates from an array. ',
|
||||
returnType: 'Element',
|
||||
aliases: ['removeDuplicates'],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/arrays/#array-unique',
|
||||
};
|
||||
|
||||
export const arrayExtensions: ExtensionMap = {
|
||||
typeName: 'Array',
|
||||
functions: {
|
||||
removeDuplicates: unique,
|
||||
unique,
|
||||
first,
|
||||
last,
|
||||
pluck,
|
||||
unique,
|
||||
randomItem,
|
||||
sum,
|
||||
min,
|
||||
|
||||
@@ -206,56 +206,100 @@ function plus(date: Date | DateTime, extraArgs: unknown[]): Date | DateTime {
|
||||
endOfMonth.doc = {
|
||||
name: 'endOfMonth',
|
||||
returnType: 'Date',
|
||||
description: 'Transforms a date to the last possible moment that lies within the month',
|
||||
description: 'Transforms a date to the last possible moment that lies within the month.',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-endOfMonth',
|
||||
};
|
||||
|
||||
isDst.doc = {
|
||||
name: 'isDst',
|
||||
returnType: 'boolean',
|
||||
description: 'Checks if a Date is within Daylight Savings Time',
|
||||
description: 'Checks if a Date is within Daylight Savings Time.',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-isDst',
|
||||
};
|
||||
|
||||
isWeekend.doc = {
|
||||
name: 'isWeekend',
|
||||
returnType: 'boolean',
|
||||
description: 'Checks if the Date falls on a Saturday or Sunday',
|
||||
description: 'Checks if the Date falls on a Saturday or Sunday.',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-isWeekend',
|
||||
};
|
||||
|
||||
// @TODO_NEXT_PHASE: Surface extensions below which take args
|
||||
|
||||
beginningOf.doc = {
|
||||
name: 'beginningOf',
|
||||
description: 'Transform a Date to the start of the given time period. Default unit is `week`.',
|
||||
returnType: 'Date',
|
||||
args: [{ name: 'unit?', type: 'DurationUnit' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-beginningOf',
|
||||
};
|
||||
|
||||
extract.doc = {
|
||||
name: 'extract',
|
||||
description: 'Extracts the part defined in `datePart` from a Date. Default unit is `week`.',
|
||||
returnType: 'number',
|
||||
args: [{ name: 'datePart?', type: 'DurationUnit' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-extract',
|
||||
};
|
||||
|
||||
format.doc = {
|
||||
name: 'format',
|
||||
returnType: '(?)',
|
||||
description: 'Formats a Date in the given structure.',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'fmt', type: 'TimeFormat' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-format',
|
||||
};
|
||||
|
||||
isBetween.doc = {
|
||||
name: 'isBetween',
|
||||
description: 'Checks if a Date is between two given dates.',
|
||||
returnType: 'boolean',
|
||||
args: [
|
||||
{ name: 'date1', type: 'Date|string' },
|
||||
{ name: 'date2', type: 'Date|string' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-isBetween',
|
||||
};
|
||||
|
||||
isInLast.doc = {
|
||||
name: 'isInLast',
|
||||
description: 'Checks if a Date is within a given time period. Default unit is `minute`.',
|
||||
returnType: 'boolean',
|
||||
args: [
|
||||
{ name: 'n', type: 'number' },
|
||||
{ name: 'unit?', type: 'DurationUnit' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-isInLast',
|
||||
};
|
||||
|
||||
minus.doc = {
|
||||
name: 'minus',
|
||||
description: 'Subtracts a given time period from a Date. Default unit is `minute`.',
|
||||
returnType: 'Date',
|
||||
args: [
|
||||
{ name: 'n', type: 'number' },
|
||||
{ name: 'unit?', type: 'DurationUnit' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-minus',
|
||||
};
|
||||
|
||||
plus.doc = {
|
||||
name: 'plus',
|
||||
description: 'Adds a given time period to a Date. Default unit is `minute`.',
|
||||
returnType: 'Date',
|
||||
args: [
|
||||
{ name: 'n', type: 'number' },
|
||||
{ name: 'unit?', type: 'DurationUnit' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/dates/#date-plus',
|
||||
};
|
||||
|
||||
export const dateExtensions: ExtensionMap = {
|
||||
|
||||
@@ -42,38 +42,57 @@ function round(value: number, extraArgs: number[]) {
|
||||
|
||||
ceil.doc = {
|
||||
name: 'ceil',
|
||||
description: 'Rounds up a number to a whole number',
|
||||
description: 'Rounds up a number to a whole number.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-ceil',
|
||||
};
|
||||
|
||||
floor.doc = {
|
||||
name: 'floor',
|
||||
description: 'Rounds down a number to a whole number',
|
||||
description: 'Rounds down a number to a whole number.',
|
||||
returnType: 'number',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-floor',
|
||||
};
|
||||
|
||||
isEven.doc = {
|
||||
name: 'isEven',
|
||||
description: 'Returns true if the number is even. Only works on whole numbers.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-isEven',
|
||||
};
|
||||
|
||||
isOdd.doc = {
|
||||
name: 'isOdd',
|
||||
description: 'Returns true if the number is odd. Only works on whole numbers.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-isOdd',
|
||||
};
|
||||
|
||||
// @TODO_NEXT_PHASE: Surface extensions below which take args
|
||||
|
||||
format.doc = {
|
||||
name: 'format',
|
||||
description:
|
||||
'Returns a formatted string of a number based on the given `LanguageCode` and `FormatOptions`. When no arguments are given, transforms the number in a like format `1.234`.',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'locales?', type: 'LanguageCode' },
|
||||
{ name: 'options?', type: 'FormatOptions' },
|
||||
],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-format',
|
||||
};
|
||||
|
||||
round.doc = {
|
||||
name: 'round',
|
||||
description:
|
||||
'Returns the value of a number rounded to the nearest whole number. Defaults to 0 decimal places if no argument is given.',
|
||||
returnType: 'number',
|
||||
args: [{ name: 'decimalPlaces?', type: 'number' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/numbers/#number-round',
|
||||
};
|
||||
|
||||
export const numberExtensions: ExtensionMap = {
|
||||
|
||||
@@ -82,48 +82,71 @@ export function urlEncode(value: object) {
|
||||
|
||||
isEmpty.doc = {
|
||||
name: 'isEmpty',
|
||||
description: 'Checks if the Object has no key-value pairs',
|
||||
description: 'Checks if the Object has no key-value pairs.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-isEmpty',
|
||||
};
|
||||
|
||||
isNotEmpty.doc = {
|
||||
name: 'isNotEmpty',
|
||||
description: 'Checks if the Object has key-value pairs',
|
||||
description: 'Checks if the Object has key-value pairs.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-isNotEmpty',
|
||||
};
|
||||
|
||||
compact.doc = {
|
||||
name: 'compact',
|
||||
description: 'Removes empty values from an Object',
|
||||
description: 'Removes empty values from an Object.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-compact',
|
||||
};
|
||||
|
||||
urlEncode.doc = {
|
||||
name: 'urlEncode',
|
||||
description: 'Transforms an Object into a URL parameter list. Only top-level keys are supported.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-urlEncode',
|
||||
};
|
||||
|
||||
// @TODO_NEXT_PHASE: Surface extensions below which take args
|
||||
|
||||
hasField.doc = {
|
||||
name: 'hasField',
|
||||
description: 'Checks if the Object has a given field. Only top-level keys are supported.',
|
||||
returnType: 'boolean',
|
||||
args: [{ name: 'fieldName', type: 'string' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-hasField',
|
||||
};
|
||||
|
||||
removeField.doc = {
|
||||
name: 'removeField',
|
||||
description: 'Removes a given field from the Object. Only top-level fields are supported.',
|
||||
returnType: 'object',
|
||||
args: [{ name: 'key', type: 'string' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-removeField',
|
||||
};
|
||||
|
||||
removeFieldsContaining.doc = {
|
||||
name: 'removeFieldsContaining',
|
||||
description:
|
||||
'Removes fields with a given value from the Object. Only top-level values are supported.',
|
||||
returnType: 'object',
|
||||
args: [{ name: 'value', type: 'string' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-removeFieldsContaining',
|
||||
};
|
||||
|
||||
keepFieldsContaining.doc = {
|
||||
name: 'keepFieldsContaining',
|
||||
description: 'Removes fields that do not match the given value from the Object.',
|
||||
returnType: 'object',
|
||||
args: [{ name: 'value', type: 'string' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/objects/#object-keepFieldsContaining',
|
||||
};
|
||||
|
||||
export const objectExtensions: ExtensionMap = {
|
||||
|
||||
@@ -288,52 +288,78 @@ function extractUrl(value: string) {
|
||||
|
||||
removeMarkdown.doc = {
|
||||
name: 'removeMarkdown',
|
||||
description: 'Removes Markdown formatting from a string',
|
||||
description: 'Removes Markdown formatting from a string.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-removeMarkdown',
|
||||
};
|
||||
|
||||
removeTags.doc = {
|
||||
name: 'removeTags',
|
||||
description: 'Removes tags, such as HTML or XML, from a string',
|
||||
description: 'Removes tags, such as HTML or XML, from a string.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-removeTags',
|
||||
};
|
||||
|
||||
toDate.doc = {
|
||||
name: 'toDate',
|
||||
description: 'Converts a string to a date',
|
||||
description: 'Converts a string to a date.',
|
||||
returnType: 'Date',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toDate',
|
||||
};
|
||||
|
||||
toFloat.doc = {
|
||||
name: 'toFloat',
|
||||
description: 'Converts a string to a decimal number',
|
||||
description: 'Converts a string to a decimal number.',
|
||||
returnType: 'number',
|
||||
aliases: ['toDecimalNumber'],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toDecimalNumber',
|
||||
};
|
||||
|
||||
toInt.doc = {
|
||||
name: 'toInt',
|
||||
description: 'Converts a string to an integer',
|
||||
description: 'Converts a string to an integer.',
|
||||
returnType: 'number',
|
||||
args: [{ name: 'radix?', type: 'number' }],
|
||||
aliases: ['toWholeNumber'],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toInt',
|
||||
};
|
||||
|
||||
toSentenceCase.doc = {
|
||||
name: 'toSentenceCase',
|
||||
description: 'Formats a string to sentence case. Example: "This is a sentence"',
|
||||
description: 'Formats a string to sentence case. Example: "This is a sentence".',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toSentenceCase',
|
||||
};
|
||||
|
||||
toSnakeCase.doc = {
|
||||
name: 'toSnakeCase',
|
||||
description: 'Formats a string to snake case. Example: "this_is_snake_case"',
|
||||
description: 'Formats a string to snake case. Example: "this_is_snake_case".',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toSnakeCase',
|
||||
};
|
||||
|
||||
toTitleCase.doc = {
|
||||
name: 'toTitleCase',
|
||||
description: 'Formats a string to title case. Example: "This Is a Title"',
|
||||
description: 'Formats a string to title case. Example: "This Is a Title".',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-toTitleCase',
|
||||
};
|
||||
|
||||
urlEncode.doc = {
|
||||
name: 'urlEncode',
|
||||
description: 'Encodes a string to be used/included in a URL.',
|
||||
args: [{ name: 'entireString?', type: 'boolean' }],
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-urlEncode',
|
||||
};
|
||||
|
||||
urlDecode.doc = {
|
||||
@@ -341,60 +367,79 @@ urlDecode.doc = {
|
||||
description:
|
||||
'Decodes a URL-encoded string. It decodes any percent-encoded characters in the input string, and replaces them with their original characters.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-urlDecode',
|
||||
};
|
||||
|
||||
replaceSpecialChars.doc = {
|
||||
name: 'replaceSpecialChars',
|
||||
description: 'Replaces non-ASCII characters in a string with an ASCII representation',
|
||||
description: 'Replaces non-ASCII characters in a string with an ASCII representation.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-replaceSpecialChars',
|
||||
};
|
||||
|
||||
length.doc = {
|
||||
name: 'length',
|
||||
description: 'Returns the character count of a string',
|
||||
description: 'Returns the character count of a string.',
|
||||
returnType: 'number',
|
||||
docURL: 'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings',
|
||||
};
|
||||
|
||||
isDomain.doc = {
|
||||
name: 'isDomain',
|
||||
description: 'Checks if a string is a domain',
|
||||
description: 'Checks if a string is a domain.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isDomain',
|
||||
};
|
||||
|
||||
isEmail.doc = {
|
||||
name: 'isEmail',
|
||||
description: 'Checks if a string is an email',
|
||||
description: 'Checks if a string is an email.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isEmail',
|
||||
};
|
||||
|
||||
isNumeric.doc = {
|
||||
name: 'isEmail',
|
||||
description: 'Checks if a string only contains digits',
|
||||
description: 'Checks if a string only contains digits.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isNumeric',
|
||||
};
|
||||
|
||||
isUrl.doc = {
|
||||
name: 'isUrl',
|
||||
description: 'Checks if a string is a valid URL',
|
||||
description: 'Checks if a string is a valid URL.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isUrl',
|
||||
};
|
||||
|
||||
isEmpty.doc = {
|
||||
name: 'isEmpty',
|
||||
description: 'Checks if a string is empty',
|
||||
description: 'Checks if a string is empty.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isEmpty',
|
||||
};
|
||||
|
||||
isNotEmpty.doc = {
|
||||
name: 'isNotEmpty',
|
||||
description: 'Checks if a string has content',
|
||||
description: 'Checks if a string has content.',
|
||||
returnType: 'boolean',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-isNotEmpty',
|
||||
};
|
||||
|
||||
extractEmail.doc = {
|
||||
name: 'extractEmail',
|
||||
description: 'Extracts an email from a string. Returns undefined if none is found.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-extractEmail',
|
||||
};
|
||||
|
||||
extractDomain.doc = {
|
||||
@@ -402,29 +447,34 @@ extractDomain.doc = {
|
||||
description:
|
||||
'Extracts a domain from a string containing a valid URL. Returns undefined if none is found.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-extractDomain',
|
||||
};
|
||||
|
||||
extractUrl.doc = {
|
||||
name: 'extractUrl',
|
||||
description: 'Extracts a URL from a string. Returns undefined if none is found.',
|
||||
returnType: 'string',
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-extractUrl',
|
||||
};
|
||||
|
||||
// @TODO_NEXT_PHASE: Surface extensions below which take args
|
||||
|
||||
hash.doc = {
|
||||
name: 'hash',
|
||||
description: 'Returns a string hashed with the given algorithm. Default algorithm is `md5`.',
|
||||
returnType: 'string',
|
||||
};
|
||||
|
||||
urlEncode.doc = {
|
||||
name: 'urlEncode',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'algo?', type: 'Algorithm' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-hash',
|
||||
};
|
||||
|
||||
quote.doc = {
|
||||
name: 'quote',
|
||||
description: 'Returns a string wrapped in the quotation marks. Default quotation is `"`.',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'mark?', type: 'string' }],
|
||||
docURL:
|
||||
'https://docs.n8n.io/code-examples/expressions/data-transformation-functions/strings/#string-quote',
|
||||
};
|
||||
|
||||
export const stringExtensions: ExtensionMap = {
|
||||
|
||||
@@ -116,7 +116,7 @@ export const arrayMethods: NativeDoc = {
|
||||
'Returns a string that concatenates all of the elements in an array, separated by `separator`, which defaults to comma.',
|
||||
docURL:
|
||||
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join',
|
||||
returnType: 'Array',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'separator?', type: 'string' }],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ export const stringMethods: NativeDoc = {
|
||||
indexOf: {
|
||||
doc: {
|
||||
name: 'indexOf',
|
||||
description: 'Returns the index of the first occurrence of `searchString`',
|
||||
description: 'Returns the index of the first occurrence of `searchString`.',
|
||||
docURL:
|
||||
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf',
|
||||
returnType: 'number',
|
||||
@@ -49,7 +49,7 @@ export const stringMethods: NativeDoc = {
|
||||
lastIndexOf: {
|
||||
doc: {
|
||||
name: 'lastIndexOf',
|
||||
description: 'Returns the index of the last occurrence of `searchString`',
|
||||
description: 'Returns the index of the last occurrence of `searchString`.',
|
||||
docURL:
|
||||
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf',
|
||||
returnType: 'number',
|
||||
|
||||
Reference in New Issue
Block a user