mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08: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:
parent
bb4db58819
commit
ae634407a4
|
@ -14,11 +14,12 @@ import {
|
|||
stripExcessParens,
|
||||
} from './utils';
|
||||
import type { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
||||
import type { ExtensionTypeName, FnToDoc, Resolved } from './types';
|
||||
import type { AutocompleteOptionType, ExtensionTypeName, FnToDoc, Resolved } from './types';
|
||||
import { sanitizeHtml } from '@/utils';
|
||||
import { NativeDoc } from 'n8n-workflow/src/Extensions/Extensions';
|
||||
|
||||
type AutocompleteOptionType = 'function' | 'keyword';
|
||||
import { isFunctionOption } from './typeGuards';
|
||||
import { luxonInstanceDocs } from './nativesAutocompleteDocs/luxon.instance.docs';
|
||||
import { luxonStaticDocs } from './nativesAutocompleteDocs/luxon.static.docs';
|
||||
|
||||
/**
|
||||
* Resolution-based completions offered according to datatype.
|
||||
|
@ -59,7 +60,7 @@ export function datatypeCompletions(context: CompletionContext): CompletionResul
|
|||
if (options.length === 0) return null;
|
||||
|
||||
if (tail !== '') {
|
||||
options = options.filter((o) => prefixMatch(o.label, tail));
|
||||
options = options.filter((o) => prefixMatch(o.label, tail) && o.label !== tail);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -103,7 +104,6 @@ function datatypeOptions(resolved: Resolved, toResolve: string) {
|
|||
|
||||
return arrayMethods.filter((m) => !NUMBER_ONLY_ARRAY_EXTENSIONS.has(m.label));
|
||||
}
|
||||
|
||||
return arrayMethods;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ export const natives = (typeName: ExtensionTypeName): Completion[] => {
|
|||
if (!natives) return [];
|
||||
|
||||
const nativeProps = natives.properties ? toOptions(natives.properties, typeName, 'keyword') : [];
|
||||
const nativeMethods = toOptions(natives.functions, typeName, 'function');
|
||||
const nativeMethods = toOptions(natives.functions, typeName, 'native-function');
|
||||
|
||||
return [...nativeProps, ...nativeMethods];
|
||||
};
|
||||
|
@ -131,24 +131,32 @@ export const extensions = (typeName: ExtensionTypeName) => {
|
|||
if (!extensions) return [];
|
||||
|
||||
const fnToDoc = Object.entries(extensions.functions).reduce<FnToDoc>((acc, [fnName, fn]) => {
|
||||
if (fn.length !== 1) return acc; // @TODO_NEXT_PHASE: Remove to allow extensions which take args
|
||||
|
||||
return { ...acc, [fnName]: { doc: fn.doc } };
|
||||
}, {});
|
||||
|
||||
return toOptions(fnToDoc, typeName);
|
||||
return toOptions(fnToDoc, typeName, 'extension-function');
|
||||
};
|
||||
|
||||
export const toOptions = (
|
||||
fnToDoc: FnToDoc,
|
||||
typeName: ExtensionTypeName,
|
||||
optionType: AutocompleteOptionType = 'function',
|
||||
optionType: AutocompleteOptionType = 'native-function',
|
||||
) => {
|
||||
return Object.entries(fnToDoc)
|
||||
.sort((a, b) => a[0].localeCompare(b[0]))
|
||||
.map(([fnName, fn]) => {
|
||||
return createCompletionOption(typeName, fnName, optionType, fn);
|
||||
});
|
||||
};
|
||||
|
||||
const createCompletionOption = (
|
||||
typeName: string,
|
||||
name: string,
|
||||
optionType: AutocompleteOptionType,
|
||||
docInfo: { doc?: DocMetadata | undefined },
|
||||
): Completion => {
|
||||
const option: Completion = {
|
||||
label: optionType === 'function' ? fnName + '()' : fnName,
|
||||
label: isFunctionOption(optionType) ? name + '()' : name,
|
||||
type: optionType,
|
||||
};
|
||||
|
||||
|
@ -156,26 +164,26 @@ export const toOptions = (
|
|||
const tooltipContainer = document.createElement('div');
|
||||
tooltipContainer.classList.add('autocomplete-info-container');
|
||||
|
||||
if (!fn.doc?.description) return null;
|
||||
if (!docInfo.doc) return null;
|
||||
|
||||
const header =
|
||||
optionType === 'function'
|
||||
? createFunctionHeader(typeName, fn)
|
||||
: createPropHeader(typeName, fn);
|
||||
const header = isFunctionOption(optionType)
|
||||
? createFunctionHeader(typeName, docInfo)
|
||||
: createPropHeader(typeName, docInfo);
|
||||
header.classList.add('autocomplete-info-header');
|
||||
tooltipContainer.appendChild(header);
|
||||
|
||||
if (docInfo.doc.description) {
|
||||
const descriptionBody = document.createElement('div');
|
||||
descriptionBody.classList.add('autocomplete-info-description');
|
||||
const descriptionText = document.createElement('p');
|
||||
descriptionText.innerHTML = sanitizeHtml(
|
||||
fn.doc.description.replace(/`(.*?)`/g, '<code>$1</code>'),
|
||||
docInfo.doc.description.replace(/`(.*?)`/g, '<code>$1</code>'),
|
||||
);
|
||||
descriptionBody.appendChild(descriptionText);
|
||||
if (fn.doc.docURL) {
|
||||
if (docInfo.doc.docURL) {
|
||||
const descriptionLink = document.createElement('a');
|
||||
descriptionLink.setAttribute('target', '_blank');
|
||||
descriptionLink.setAttribute('href', fn.doc.docURL);
|
||||
descriptionLink.setAttribute('href', docInfo.doc.docURL);
|
||||
descriptionLink.innerText = i18n.autocompleteUIValues['docLinkLabel'] || 'Learn more';
|
||||
descriptionLink.addEventListener('mousedown', (event: MouseEvent) => {
|
||||
// This will prevent documentation popup closing before click
|
||||
|
@ -186,12 +194,12 @@ export const toOptions = (
|
|||
descriptionBody.appendChild(descriptionLink);
|
||||
}
|
||||
tooltipContainer.appendChild(descriptionBody);
|
||||
}
|
||||
|
||||
return tooltipContainer;
|
||||
};
|
||||
|
||||
return option;
|
||||
});
|
||||
};
|
||||
|
||||
const createFunctionHeader = (typeName: string, fn: { doc?: DocMetadata | undefined }) => {
|
||||
|
@ -199,10 +207,12 @@ const createFunctionHeader = (typeName: string, fn: { doc?: DocMetadata | undefi
|
|||
if (fn.doc) {
|
||||
const typeNameSpan = document.createElement('span');
|
||||
typeNameSpan.innerHTML = typeName.slice(0, 1).toUpperCase() + typeName.slice(1) + '.';
|
||||
header.appendChild(typeNameSpan);
|
||||
|
||||
const functionNameSpan = document.createElement('span');
|
||||
functionNameSpan.classList.add('autocomplete-info-name');
|
||||
functionNameSpan.innerHTML = `${fn.doc.name}`;
|
||||
header.appendChild(functionNameSpan);
|
||||
let functionArgs = '(';
|
||||
if (fn.doc.args) {
|
||||
functionArgs += fn.doc.args
|
||||
|
@ -219,15 +229,13 @@ const createFunctionHeader = (typeName: string, fn: { doc?: DocMetadata | undefi
|
|||
const argsSpan = document.createElement('span');
|
||||
argsSpan.classList.add('autocomplete-info-name-args');
|
||||
argsSpan.innerText = functionArgs;
|
||||
|
||||
header.appendChild(argsSpan);
|
||||
if (fn.doc.returnType) {
|
||||
const returnTypeSpan = document.createElement('span');
|
||||
returnTypeSpan.innerHTML = ': ' + fn.doc.returnType;
|
||||
|
||||
header.appendChild(typeNameSpan);
|
||||
header.appendChild(functionNameSpan);
|
||||
header.appendChild(argsSpan);
|
||||
header.appendChild(returnTypeSpan);
|
||||
}
|
||||
}
|
||||
return header;
|
||||
};
|
||||
|
||||
|
@ -285,9 +293,18 @@ const objectOptions = (toResolve: string, resolved: IDataObject) => {
|
|||
};
|
||||
|
||||
const infoKey = [name, key].join('.');
|
||||
const info = i18n.proxyVars[infoKey];
|
||||
|
||||
if (info) option.info = info;
|
||||
option.info = createCompletionOption(
|
||||
'Object',
|
||||
key,
|
||||
isFunction ? 'native-function' : 'keyword',
|
||||
{
|
||||
doc: {
|
||||
name: key,
|
||||
returnType: typeof resolved[key],
|
||||
description: i18n.proxyVars[infoKey],
|
||||
},
|
||||
},
|
||||
).info;
|
||||
|
||||
return option;
|
||||
});
|
||||
|
@ -325,17 +342,8 @@ export const luxonInstanceOptions = () => {
|
|||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, descriptor]) => {
|
||||
const isFunction = typeof descriptor.value === 'function';
|
||||
|
||||
const option: Completion = {
|
||||
label: isFunction ? key + '()' : key,
|
||||
type: isFunction ? 'function' : 'keyword',
|
||||
};
|
||||
|
||||
const info = i18n.luxonInstance[key];
|
||||
|
||||
if (info) option.info = info;
|
||||
|
||||
return option;
|
||||
const optionType = isFunction ? 'native-function' : 'keyword';
|
||||
return createLuxonAutocompleteOption(key, optionType, luxonInstanceDocs, i18n.luxonInstance);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -349,17 +357,47 @@ export const luxonStaticOptions = () => {
|
|||
.filter((key) => !SKIP.has(key) && !key.includes('_'))
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.map((key) => {
|
||||
const option: Completion = {
|
||||
label: key + '()',
|
||||
type: 'function',
|
||||
return createLuxonAutocompleteOption(
|
||||
key,
|
||||
'native-function',
|
||||
luxonStaticDocs,
|
||||
i18n.luxonStatic,
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const info = i18n.luxonStatic[key];
|
||||
|
||||
if (info) option.info = info;
|
||||
const createLuxonAutocompleteOption = (
|
||||
name: string,
|
||||
type: AutocompleteOptionType,
|
||||
docDefinition: NativeDoc,
|
||||
translations: Record<string, string | undefined>,
|
||||
): Completion => {
|
||||
const option: Completion = {
|
||||
label: isFunctionOption(type) ? name + '()' : name,
|
||||
type,
|
||||
};
|
||||
|
||||
let doc: DocMetadata | undefined;
|
||||
if (docDefinition.properties && docDefinition.properties.hasOwnProperty(name)) {
|
||||
doc = docDefinition.properties[name].doc;
|
||||
} else if (docDefinition.functions.hasOwnProperty(name)) {
|
||||
doc = docDefinition.functions[name].doc;
|
||||
} else {
|
||||
// Use inferred/default values if docs are still not updated
|
||||
// This should happen when our doc specification becomes
|
||||
// out-od-date with Luxon implementation
|
||||
const optionType = typeof DateTime.prototype[name as keyof DateTime];
|
||||
doc = {
|
||||
name,
|
||||
returnType: !optionType || optionType === 'undefined' ? '' : optionType,
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetime',
|
||||
};
|
||||
}
|
||||
option.info = createCompletionOption('DateTime', name, type, {
|
||||
// Add translated description
|
||||
doc: { ...doc, description: translations[name] } as DocMetadata,
|
||||
}).info;
|
||||
return option;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,551 @@
|
|||
import { NativeDoc } from 'n8n-workflow/src/Extensions/Extensions';
|
||||
|
||||
// Autocomplete documentation definition for DateTime instance props and methods
|
||||
// Descriptions are added dynamically so they can be localized
|
||||
export const luxonInstanceDocs: Required<NativeDoc> = {
|
||||
typeName: 'DateTime',
|
||||
properties: {
|
||||
day: {
|
||||
doc: {
|
||||
name: 'day',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeday',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
daysInMonth: {
|
||||
doc: {
|
||||
name: 'daysInMonth',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimedaysinmonth',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
daysInYear: {
|
||||
doc: {
|
||||
name: 'daysInYear',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimedaysinyear',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
hour: {
|
||||
doc: {
|
||||
name: 'hour',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimehour',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
locale: {
|
||||
doc: {
|
||||
name: 'locale',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimelocale',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
millisecond: {
|
||||
doc: {
|
||||
name: 'millisecond',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemillisecond',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
minute: {
|
||||
doc: {
|
||||
name: 'minute',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeminute',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
month: {
|
||||
doc: {
|
||||
name: 'month',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemonth',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
monthLong: {
|
||||
doc: {
|
||||
name: 'monthLong',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemonthlong',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
monthShort: {
|
||||
doc: {
|
||||
name: 'monthShort',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemonthshort',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
numberingSystem: {
|
||||
doc: {
|
||||
name: 'numberingSystem',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimenumberingsystem',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
offset: {
|
||||
doc: {
|
||||
name: 'offset',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeoffset',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
offsetNameLong: {
|
||||
doc: {
|
||||
name: 'offsetNameLong',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeoffsetnamelong',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
offsetNameShort: {
|
||||
doc: {
|
||||
name: 'offsetNameShort',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeoffsetnameshort',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
ordinal: {
|
||||
doc: {
|
||||
name: 'ordinal',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeordinal',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
outputCalendar: {
|
||||
doc: {
|
||||
name: 'outputCalendar',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeoutputcalendar',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
quarter: {
|
||||
doc: {
|
||||
name: 'quarter',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimequarter',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
second: {
|
||||
doc: {
|
||||
name: 'second',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimesecond',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
weekday: {
|
||||
doc: {
|
||||
name: 'weekday',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweekday',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
weekdayLong: {
|
||||
doc: {
|
||||
name: 'weekdayLong',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweekdaylong',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
weekdayShort: {
|
||||
doc: {
|
||||
name: 'weekdayShort',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweekdayshort',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
weekNumber: {
|
||||
doc: {
|
||||
name: 'weekNumber',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweeknumber',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
weeksInWeekYear: {
|
||||
doc: {
|
||||
name: 'weeksInWeekYear',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweeksinweekyear',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
weekYear: {
|
||||
doc: {
|
||||
name: 'weekYear',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeweekyear',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
year: {
|
||||
doc: {
|
||||
name: 'year',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeyear',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
zone: {
|
||||
doc: {
|
||||
name: 'zone',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimezone',
|
||||
returnType: 'Zone',
|
||||
},
|
||||
},
|
||||
zoneName: {
|
||||
doc: {
|
||||
name: 'zoneName',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimezonename',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
isInDST: {
|
||||
doc: {
|
||||
name: 'isInDST',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeisindst',
|
||||
returnType: 'boolean',
|
||||
},
|
||||
},
|
||||
isInLeapYear: {
|
||||
doc: {
|
||||
name: 'isInLeapYear',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeisinleapyear',
|
||||
returnType: 'boolean',
|
||||
},
|
||||
},
|
||||
isOffsetFixed: {
|
||||
doc: {
|
||||
name: 'isOffsetFixed',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeisoffsetfixed',
|
||||
returnType: 'boolean',
|
||||
},
|
||||
},
|
||||
isValid: {
|
||||
doc: {
|
||||
name: 'isValid',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeisvalid',
|
||||
returnType: 'boolean',
|
||||
},
|
||||
},
|
||||
},
|
||||
functions: {
|
||||
diff: {
|
||||
doc: {
|
||||
name: 'diff',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimediff',
|
||||
returnType: 'Duration',
|
||||
args: [
|
||||
{ name: 'other', type: 'DateTime' },
|
||||
{ name: 'unit', type: 'string|string[]' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
diffNow: {
|
||||
doc: {
|
||||
name: 'diffNow',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimediffnow',
|
||||
returnType: 'Duration',
|
||||
args: [
|
||||
{ name: 'unit', type: 'string|string[]' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
endOf: {
|
||||
doc: {
|
||||
name: 'endOf',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeendof',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'unit', type: 'string' }],
|
||||
},
|
||||
},
|
||||
equals: {
|
||||
doc: {
|
||||
name: 'equals',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeequals',
|
||||
returnType: 'boolean',
|
||||
args: [{ name: 'other', type: 'DateTime' }],
|
||||
},
|
||||
},
|
||||
hasSame: {
|
||||
doc: {
|
||||
name: 'hasSame',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimehassame',
|
||||
returnType: 'boolean',
|
||||
args: [
|
||||
{ name: 'other', type: 'DateTime' },
|
||||
{ name: 'unit', type: 'string' },
|
||||
],
|
||||
},
|
||||
},
|
||||
minus: {
|
||||
doc: {
|
||||
name: 'minus',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeminus',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'duration', type: 'Duration|object|number' }],
|
||||
},
|
||||
},
|
||||
plus: {
|
||||
doc: {
|
||||
name: 'plus',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeplus',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'duration', type: 'Duration|object|number' }],
|
||||
},
|
||||
},
|
||||
reconfigure: {
|
||||
doc: {
|
||||
name: 'reconfigure',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimereconfigure',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'properties', type: 'object' }],
|
||||
},
|
||||
},
|
||||
resolvedLocaleOptions: {
|
||||
doc: {
|
||||
name: 'resolvedLocaleOptions',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeresolvedlocaleoptions',
|
||||
returnType: 'object',
|
||||
args: [{ name: 'opts', type: 'object' }],
|
||||
},
|
||||
},
|
||||
set: {
|
||||
doc: {
|
||||
name: 'set',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeset',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'values', type: 'object' }],
|
||||
},
|
||||
},
|
||||
setLocale: {
|
||||
doc: {
|
||||
name: 'setLocale',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimesetlocale',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'locale', type: 'any' }],
|
||||
},
|
||||
},
|
||||
setZone: {
|
||||
doc: {
|
||||
name: 'setZone',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimesetzone',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'zone', type: 'string|Zone' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
startOf: {
|
||||
doc: {
|
||||
name: 'startOf',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimestartof',
|
||||
returnType: 'DateTime',
|
||||
args: [{ name: 'unit', type: 'string' }],
|
||||
},
|
||||
},
|
||||
toBSON: {
|
||||
doc: {
|
||||
name: 'toBSON',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetobson',
|
||||
returnType: 'Date',
|
||||
},
|
||||
},
|
||||
toFormat: {
|
||||
doc: {
|
||||
name: 'toFormat',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetime',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'fmt', type: 'string' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
toHTTP: {
|
||||
doc: {
|
||||
name: 'toHTTP',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetohttp',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toISO: {
|
||||
doc: {
|
||||
name: 'toISO',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoiso',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'opts', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toISODate: {
|
||||
doc: {
|
||||
name: 'toISODate',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoisodate',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'opts', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toISOTime: {
|
||||
doc: {
|
||||
name: 'toISOTime',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoisotime',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'opts', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toISOWeekDate: {
|
||||
doc: {
|
||||
name: 'toISOWeekDate',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoisoweekdate',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toJSDate: {
|
||||
doc: {
|
||||
name: 'toJSDate',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetojsdate',
|
||||
returnType: 'Date',
|
||||
},
|
||||
},
|
||||
toJSON: {
|
||||
doc: {
|
||||
name: 'toJSON',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetojson',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toLocal: {
|
||||
doc: {
|
||||
name: 'toLocal',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetolocal',
|
||||
returnType: 'DateTime',
|
||||
},
|
||||
},
|
||||
toLocaleParts: {
|
||||
doc: {
|
||||
name: 'toLocaleParts',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetolocaleparts',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'formatOpts', type: 'any' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
toLocaleString: {
|
||||
doc: {
|
||||
name: 'toLocaleString',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetolocalestring',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'formatOpts', type: 'any' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
toMillis: {
|
||||
doc: {
|
||||
name: 'toMillis',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetomillis',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
toObject: {
|
||||
doc: {
|
||||
name: 'toObject',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoobject',
|
||||
returnType: 'object',
|
||||
args: [{ name: 'opts', type: 'any' }],
|
||||
},
|
||||
},
|
||||
toRelative: {
|
||||
doc: {
|
||||
name: 'toRelative',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetorelative',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'options', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toRelativeCalendar: {
|
||||
doc: {
|
||||
name: 'toRelativeCalendar',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetorelativecalendar',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'options', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toRFC2822: {
|
||||
doc: {
|
||||
name: 'toRFC2822',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetorfc2822',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toSeconds: {
|
||||
doc: {
|
||||
name: 'toSeconds',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoseconds',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
toSQL: {
|
||||
doc: {
|
||||
name: 'toSQL',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetosql',
|
||||
returnType: 'string',
|
||||
args: [{ name: 'options', type: 'object' }],
|
||||
},
|
||||
},
|
||||
toSQLDate: {
|
||||
doc: {
|
||||
name: 'toSQLDate',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetosqldate',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toSQLTime: {
|
||||
doc: {
|
||||
name: 'toSQLTime',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetosqltime',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toString: {
|
||||
doc: {
|
||||
name: 'toString',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetostring',
|
||||
returnType: 'string',
|
||||
},
|
||||
},
|
||||
toUnixInteger: {
|
||||
doc: {
|
||||
name: 'toUnixInteger',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetounixinteger',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
toUTC: {
|
||||
doc: {
|
||||
name: 'toUTC',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimetoutc',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'offset', type: 'number' },
|
||||
{ name: 'opts', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
until: {
|
||||
doc: {
|
||||
name: 'until',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeuntil',
|
||||
returnType: 'Interval',
|
||||
args: [{ name: 'other', type: 'DateTime' }],
|
||||
},
|
||||
},
|
||||
valueOf: {
|
||||
doc: {
|
||||
name: 'valueOf',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimevalueof',
|
||||
returnType: 'number',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
|
@ -0,0 +1,250 @@
|
|||
import { NativeDoc } from 'n8n-workflow/src/Extensions/Extensions';
|
||||
|
||||
// Autocomplete documentation definition for DateTime class static props and methods
|
||||
// Descriptions are added dynamically so they can be localized
|
||||
export const luxonStaticDocs: Required<NativeDoc> = {
|
||||
typeName: 'DateTime',
|
||||
properties: {},
|
||||
functions: {
|
||||
now: {
|
||||
doc: {
|
||||
name: 'now',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimenow',
|
||||
returnType: 'DateTime',
|
||||
},
|
||||
},
|
||||
local: {
|
||||
doc: {
|
||||
name: 'local',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimelocal',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'year?', type: 'number' },
|
||||
{ name: 'month', type: 'number' },
|
||||
{ name: 'day', type: 'number' },
|
||||
{ name: 'hour', type: 'number' },
|
||||
{ name: 'minute', type: 'number' },
|
||||
{ name: 'second', type: 'number' },
|
||||
{ name: 'millisecond', type: 'number' },
|
||||
],
|
||||
},
|
||||
},
|
||||
utc: {
|
||||
doc: {
|
||||
name: 'utc',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeutc',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'year?', type: 'number' },
|
||||
{ name: 'month', type: 'number' },
|
||||
{ name: 'day', type: 'number' },
|
||||
{ name: 'hour', type: 'number' },
|
||||
{ name: 'minute', type: 'number' },
|
||||
{ name: 'second', type: 'number' },
|
||||
{ name: 'millisecond', type: 'number' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromJSDate: {
|
||||
doc: {
|
||||
name: 'fromJSDate',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromjsdate',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'date', type: 'Date' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromMillis: {
|
||||
doc: {
|
||||
name: 'fromMillis',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefrommillis',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'milliseconds', type: 'number' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromSeconds: {
|
||||
doc: {
|
||||
name: 'fromSeconds',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromseconds',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'seconds', type: 'number' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromObject: {
|
||||
doc: {
|
||||
name: 'fromObject',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromobject',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'obj', type: 'object' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromISO: {
|
||||
doc: {
|
||||
name: 'fromISO',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromiso',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromRFC2822: {
|
||||
doc: {
|
||||
name: 'fromRFC2822',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromrfc2822',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromHTTP: {
|
||||
doc: {
|
||||
name: 'fromHTTP',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromhttp',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromFormat: {
|
||||
doc: {
|
||||
name: 'fromFormat',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromformat',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'fmt', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromSQL: {
|
||||
doc: {
|
||||
name: 'fromSQL',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromsql',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
invalid: {
|
||||
doc: {
|
||||
name: 'invalid',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeinvalid',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'reason', type: 'DateTime' },
|
||||
{ name: 'explanation?', type: 'string' },
|
||||
],
|
||||
},
|
||||
},
|
||||
isDateTime: {
|
||||
doc: {
|
||||
name: 'isDateTime',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeisdatetime',
|
||||
returnType: 'boolean',
|
||||
args: [{ name: 'o', type: 'object' }],
|
||||
},
|
||||
},
|
||||
expandFormat: {
|
||||
doc: {
|
||||
name: 'expandFormat',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeexpandformat',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'fmt', type: 'any' },
|
||||
{ name: 'localeOpts?', type: 'any' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromFormatExplain: {
|
||||
doc: {
|
||||
name: 'fromFormatExplain',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromformatexplain',
|
||||
returnType: 'object',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'fmt', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromString: {
|
||||
doc: {
|
||||
name: 'fromString',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromstring',
|
||||
returnType: 'DateTime',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'fmt', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
fromStringExplain: {
|
||||
doc: {
|
||||
name: 'fromStringExplain',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimefromstringexplain',
|
||||
returnType: 'object',
|
||||
args: [
|
||||
{ name: 'text', type: 'string' },
|
||||
{ name: 'fmt', type: 'string' },
|
||||
{ name: 'options?', type: 'object' },
|
||||
],
|
||||
},
|
||||
},
|
||||
max: {
|
||||
doc: {
|
||||
name: 'max',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemax',
|
||||
returnType: 'DateTime|undefined',
|
||||
args: [
|
||||
{ name: 'dateTime1', type: 'DateTime' },
|
||||
{ name: '...' },
|
||||
{ name: 'dateTimeN', type: 'DateTime' },
|
||||
],
|
||||
},
|
||||
},
|
||||
min: {
|
||||
doc: {
|
||||
name: 'min',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimemin',
|
||||
returnType: 'DateTime|undefined',
|
||||
args: [
|
||||
{ name: 'dateTime1', type: 'DateTime' },
|
||||
{ name: '...' },
|
||||
{ name: 'dateTimeN', type: 'DateTime' },
|
||||
],
|
||||
},
|
||||
},
|
||||
parseFormatForOpts: {
|
||||
doc: {
|
||||
name: 'parseFormatForOpts',
|
||||
docURL: 'https://moment.github.io/luxon/api-docs/index.html#datetimeparseformatforopts',
|
||||
returnType: 'string',
|
||||
args: [
|
||||
{ name: 'fmt', type: 'any' },
|
||||
{ name: 'localeOpts?', type: 'any' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
import { AutocompleteOptionType, FunctionOptionType } from './types';
|
||||
|
||||
export const isFunctionOption = (value: AutocompleteOptionType): value is FunctionOptionType => {
|
||||
return value === 'native-function' || value === 'extension-function';
|
||||
};
|
|
@ -6,3 +6,7 @@ export type Resolved = ReturnType<typeof resolveParameter>;
|
|||
export type ExtensionTypeName = 'number' | 'string' | 'date' | 'array' | 'object';
|
||||
|
||||
export type FnToDoc = { [fnName: string]: { doc?: DocMetadata } };
|
||||
|
||||
export type FunctionOptionType = 'native-function' | 'extension-function';
|
||||
export type KeywordOptionType = 'keyword';
|
||||
export type AutocompleteOptionType = FunctionOptionType | KeywordOptionType;
|
||||
|
|
|
@ -450,7 +450,7 @@ export class I18nClass {
|
|||
toJSON: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.toJSON'),
|
||||
toBSON: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.toBSON'),
|
||||
toObject: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.toObject'),
|
||||
toJsDate: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.toJsDate'),
|
||||
toJSDate: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.toJsDate'),
|
||||
diff: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.diff'),
|
||||
diffNow: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.diffNow'),
|
||||
until: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.until'),
|
||||
|
@ -462,6 +462,10 @@ export class I18nClass {
|
|||
),
|
||||
min: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.min'),
|
||||
max: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.max'),
|
||||
reconfigure: this.baseText('codeNodeEditor.completer.luxon.instanceMethods.reconfigure'),
|
||||
resolvedLocaleOptions: this.baseText(
|
||||
'codeNodeEditor.completer.luxon.instanceMethods.resolvedLocaleOptions',
|
||||
),
|
||||
};
|
||||
|
||||
luxonStatic: Record<string, string | undefined> = {
|
||||
|
@ -479,6 +483,21 @@ export class I18nClass {
|
|||
fromSQL: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromSQL'),
|
||||
invalid: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.invalid'),
|
||||
isDateTime: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.isDateTime'),
|
||||
expandFormat: this.baseText(
|
||||
'codeNodeEditor.completer.luxon.dateTimeStaticMethods.expandFormat',
|
||||
),
|
||||
fromFormatExplain: this.baseText(
|
||||
'codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromFormatExplain',
|
||||
),
|
||||
fromString: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromString'),
|
||||
fromStringExplain: this.baseText(
|
||||
'codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromStringExplain',
|
||||
),
|
||||
max: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.max'),
|
||||
min: this.baseText('codeNodeEditor.completer.luxon.dateTimeStaticMethods.min'),
|
||||
parseFormatForOpts: this.baseText(
|
||||
'codeNodeEditor.completer.luxon.dateTimeStaticMethods.parseFormatForOpts',
|
||||
),
|
||||
};
|
||||
|
||||
autocompleteUIValues: Record<string, string | undefined> = {
|
||||
|
|
|
@ -140,37 +140,44 @@
|
|||
"codeNodeEditor.completer.globalObject.keys": "The object's keys",
|
||||
"codeNodeEditor.completer.globalObject.values": "The object's values",
|
||||
"codeNodeEditor.completer.json": "The item's JSON data. When in doubt, use this",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.expandFormat": "Produce the the fully expanded format token for the locale Does NOT quote characters, so quoted tokens will not round trip correctly.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromFormat": "Create a DateTime from an input string and format string.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromFormatExplain": "Explain how a string would be parsed by fromFormat().",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromHTTP": "Create a DateTime from an HTTP header date",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromISO": "Create a DateTime from an ISO 8601 string",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromJSDate": "Create a DateTime from a JavaScript Date object. Uses the default zone",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromMillis": "Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromObject": "Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromRFC2822": "Create a DateTime from an RFC 2822 string",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromString": "Deprecated: use `fromFormat` instead.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromStringExplain": "Deprecated: use `fromFormatExplain` instead.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromSQL": "Create a DateTime from a SQL date, time, or datetime",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.fromSeconds": "Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.invalid": "Create an invalid DateTime.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.isDateTime": "Check if an object is a DateTime. Works across context boundaries",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.local": "Create a local DateTime",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.max": "Return the max of several date times.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.min": "Return the min of several date times.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.now": "Create a DateTime for the current instant, in the system's time zone",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.parseFormatForOpts": "Produce the the fully expanded format token for the locale Does NOT quote characters, so quoted tokens will not round trip correctly.",
|
||||
"codeNodeEditor.completer.luxon.dateTimeStaticMethods.utc": "Create a DateTime in UTC",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.day": "Get the day of the month (1-30ish).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.daysInMonth": "Returns the number of days in this DateTime's month",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.daysInYear": "Returns the number of days in this DateTime's year",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.daysInMonth": "Returns the number of days in this DateTime's month.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.daysInYear": "Returns the number of days in this DateTime's year.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.diff": "Return the difference between two DateTimes as a Duration.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.diffNow": "Return the difference between this DateTime and right now.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.endOf": "Set this DateTime to the end (meaning the last millisecond) of a unit of time",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.equals": "Equality check",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.endOf": "Set this DateTime to the end (meaning the last millisecond) of a unit of time.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.equals": "Equality check.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.hasSame": "Return whether this DateTime is in the same unit of time as another DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.hour": "Get the hour of the day (0-23).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.invalidExplanation": "Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.invalidReason": "Returns an error code if this DateTime is invalid, or null if the DateTime is valid",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.invalidExplanation": "Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.invalidReason": "Returns an error code if this DateTime is invalid, or null if the DateTime is valid.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.isInDST": "Get whether the DateTime is in a DST.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.isInLeapYear": "Returns true if this DateTime is in a leap year, false otherwise",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.isInLeapYear": "Returns true if this DateTime is in a leap year, false otherwise.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.isOffsetFixed": "Get whether this zone's offset ever changes, as in a DST.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.isValid": "Returns whether the DateTime is valid. Invalid DateTimes occur when The DateTime was created from invalid calendar information, such as the 13th month or February 30. The DateTime was created by an operation on another invalid date.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.locale": "Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.max": "Return the max of several date times",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.locale": "Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.max": "Return the max of several date times.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.millisecond": "Get the millisecond of the second (0-999).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.min": "Return the min of several date times",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.minus": "Subtract hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds.",
|
||||
|
@ -178,15 +185,17 @@
|
|||
"codeNodeEditor.completer.luxon.instanceMethods.month": "Get the month (1-12).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.monthLong": "Get the human readable long month name, such as 'October'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.monthShort": "Get the human readable short month name, such as 'Oct'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.numberingSystem": "Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.numberingSystem": "Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offset": "Get the UTC offset of this DateTime in minutes",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNameLong": "Get the long human name for the zone\\'s current offset, for example \"Eastern Standard Time\" or \" Eastern Daylight Time\".",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNameShort": "Get the short human name for the zone\\'s current offset, for example \"EST\" or \"EDT\".'",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNumber": "Get the short human name for the zone\\'s current offset, for example \"EST\" or \"EDT\".'",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.ordinal": "Get the ordinal (meaning the day of the year)",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.outputCalendar": "Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNameLong": "Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNameShort": "Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".'",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.offsetNumber": "Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".'",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.ordinal": "Get the ordinal (meaning the day of the year).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.outputCalendar": "Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.plus": "Add hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.quarter": "Get the quarter",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.quarter": "Get the quarter.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.reconfigure": "'Set' the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.resolvedLocaleOptions": "Returns the resolved Intl options for this DateTime. This is useful in understanding the behavior of formatting methods.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.second": "Get the second of the minute (0-59).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.set": "Set the values of specified units. Returns a newly-constructed DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.setLocale": "Set the locale. Returns a newly-constructed DateTime.",
|
||||
|
@ -195,10 +204,10 @@
|
|||
"codeNodeEditor.completer.luxon.instanceMethods.toBSON": "Returns a BSON serializable equivalent to this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toFormat": "Returns a string representation of this DateTime formatted according to the specified format string.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toHTTP": "Returns a string representation of this DateTime appropriate for use in HTTP headers.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISO": "Returns an ISO 8601-compliant string representation of this DateTime",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISODate": "Returns an ISO 8601-compliant string representation of this DateTime's date component",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISOTime": "Returns an ISO 8601-compliant string representation of this DateTime's time component",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISOWeekDate": "Returns an ISO 8601-compliant string representation of this DateTime's week date",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISO": "Returns an ISO 8601-compliant string representation of this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISODate": "Returns an ISO 8601-compliant string representation of this DateTime's date component.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISOTime": "Returns an ISO 8601-compliant string representation of this DateTime's time component.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toISOWeekDate": "Returns an ISO 8601-compliant string representation of this DateTime's week date.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toJSON": "Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toJsDate": "Returns a JavaScript Date equivalent to this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toLocal": "Set the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.",
|
||||
|
@ -206,25 +215,25 @@
|
|||
"codeNodeEditor.completer.luxon.instanceMethods.toLocaleString": "Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toMillis": "Returns the epoch milliseconds of this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toObject": "Returns a JavaScript object with this DateTime's year, month, day, and so on.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toRFC2822": "Returns an RFC 2822-compatible string representation of this DateTime, always in UTC",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toRFC2822": "Returns an RFC 2822-compatible string representation of this DateTime, always in UTC.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toRelative": "Returns a string representation of a this time relative to now, such as 'in two days'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toRelativeCalendar": "Returns a string representation of this date relative to today, such as '\"'yesterday' or 'next month'",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toRelativeCalendar": "Returns a string representation of this date relative to today, such as '\"'yesterday' or 'next month'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSQL": "Returns a string representation of this DateTime appropriate for use in SQL DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSQLDate": "Returns a string representation of this DateTime appropriate for use in SQL Date",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSQLTime": "Returns a string representation of this DateTime appropriate for use in SQL Time",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSQLDate": "Returns a string representation of this DateTime appropriate for use in SQL Date.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSQLTime": "Returns a string representation of this DateTime appropriate for use in SQL Time.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toSeconds": "Returns the epoch seconds of this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toString": "Returns a string representation of this DateTime appropriate for debugging",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toString": "Returns a string representation of this DateTime appropriate for debugging.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toUTC": "Set the DateTime's zone to UTC. Returns a newly-constructed DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.toUnixInteger": "Returns the epoch seconds (as a whole number) of this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.until": "Return an Interval spanning between this DateTime and another DateTime",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.until": "Return an Interval spanning between this DateTime and another DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.valueOf": "Returns the epoch milliseconds of this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekNumber": "Get the week number of the week year (1-52ish).",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekYear": "Get the week year",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekYear": "Get the week year.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekday": "Get the day of the week. 1 is Monday and 7 is Sunday.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekdayLong": "Get the human readable long weekday, such as 'Monday'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weekdayShort": "Get the human readable short weekday, such as 'Mon'.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weeksInWeekYear": "Returns the number of weeks in this DateTime's year",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.year": "Get the year",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.weeksInWeekYear": "Returns the number of weeks in this DateTime's year.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.year": "Get the year.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.zone": "Get the time zone associated with this DateTime.",
|
||||
"codeNodeEditor.completer.luxon.instanceMethods.zoneName": "Get the name of the time zone.",
|
||||
"codeNodeEditor.completer.selector.all": "@:_reusableBaseText.codeNodeEditor.completer.all",
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
.cm-tooltip-autocomplete:after {
|
||||
display: block;
|
||||
content: 'n8n supports all JavaScript functions, including those not listed.';
|
||||
padding: var(--spacing-2xs) var(--spacing-s);
|
||||
border-top: 1px solid var(--color-foreground-dark);
|
||||
}
|
||||
|
||||
// Custom autocomplete item type icons
|
||||
// 1. Native and n8n extension functions:
|
||||
.cm-completionIcon-extension-function, .cm-completionIcon-native-function {
|
||||
&::after {
|
||||
content: 'ƒ';
|
||||
}
|
||||
}
|
||||
|
||||
.cm-tooltip-autocomplete {
|
||||
background-color: var(--color-background-xlight) !important;
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue