mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
675ec21d33
- Split Items List node into separate nodes per action - Review node descriptions - New icons - New sections in subcategories --------- Co-authored-by: Giulio Andreini <andreini@netseven.it> Co-authored-by: Deborah <deborah@starfallprojects.co.uk> Co-authored-by: Michael Kret <michael.k@radency.com>
15 lines
410 B
TypeScript
15 lines
410 B
TypeScript
export const prepareFieldsArray = (fields: string | string[], fieldName = 'Fields') => {
|
|
if (typeof fields === 'string') {
|
|
return fields
|
|
.split(',')
|
|
.map((entry) => entry.trim())
|
|
.filter((entry) => entry !== '');
|
|
}
|
|
if (Array.isArray(fields)) {
|
|
return fields;
|
|
}
|
|
throw new Error(
|
|
`The \'${fieldName}\' parameter must be a string of fields separated by commas or an array of strings.`,
|
|
);
|
|
};
|