pull:初次提交
This commit is contained in:
17
n8n-n8n-1.109.2/packages/nodes-base/nodes/Transform/utils/utils.ts
Executable file
17
n8n-n8n-1.109.2/packages/nodes-base/nodes/Transform/utils/utils.ts
Executable file
@@ -0,0 +1,17 @@
|
||||
import { ApplicationError } from '@n8n/errors';
|
||||
|
||||
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 ApplicationError(
|
||||
`The \'${fieldName}\' parameter must be a string of fields separated by commas or an array of strings.`,
|
||||
{ level: 'warning' },
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user