This commit is contained in:
Joel Wetzell
2026-05-17 21:12:04 -05:00
parent 69bc31d3f1
commit 8e6cd58006
82 changed files with 642 additions and 450 deletions
+7 -5
View File
@@ -1,8 +1,8 @@
---
title: Execute JavaScript
sidebar:
label: JavaScript
order: 1
label: JavaScript
order: 1
---
The `script.js` processor takes in any payload type and executes a JavaScript function that is able to process the payload. The end value of `payload` will be returned as the output of the processor.
@@ -13,13 +13,15 @@ This run your JavaScript program in a [sandboxed environment](https://gitlab.com
- **type**: `script.js`
- **params**:
- **program**: The JavaScript program to run. The payload is available as a global variable called `payload`.
- **program**: The JavaScript program to run. The payload is available as a global variable called `payload`.
### Example
Replace all occurrences of `|` with `,` in the payload
```yaml
- type: script.js
params:
program: |
payload = payload.replaceAll('|',',');
```
payload = payload.replaceAll('|',',');
```