Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import {
|
|
IExecuteFunctions,
|
|
INodeExecutionData,
|
|
INodeType,
|
|
INodeTypeDescription,
|
|
} from 'n8n-workflow';
|
|
|
|
export class ClassNameReplace implements INodeType {
|
|
description: INodeTypeDescription = {
|
|
displayName: 'DisplayNameReplace',
|
|
name: 'N8nNameReplace',
|
|
group: ['transform'],
|
|
version: 1,
|
|
description: 'NodeDescriptionReplace',
|
|
defaults: {
|
|
name: 'DisplayNameReplace',
|
|
color: '#772244',
|
|
},
|
|
inputs: ['main'],
|
|
outputs: ['main'],
|
|
properties: [
|
|
// Node properties which the user gets displayed and
|
|
// can change on the node.
|
|
{
|
|
displayName: 'My String',
|
|
name: 'myString',
|
|
type: 'string',
|
|
default: '',
|
|
placeholder: 'Placeholder value',
|
|
description: 'The description text',
|
|
},
|
|
],
|
|
};
|
|
|
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
const items = this.getInputData();
|
|
|
|
let item: INodeExecutionData;
|
|
let myString: string;
|
|
|
|
// Iterates over all input items and add the key "myString" with the
|
|
// value the parameter "myString" resolves to.
|
|
// (This could be a different value for each item in case it contains an expression)
|
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
myString = this.getNodeParameter('myString', itemIndex, '') as string;
|
|
item = items[itemIndex];
|
|
|
|
item.json.myString = myString;
|
|
}
|
|
|
|
return [items];
|
|
}
|
|
}
|