JS Function
A JavaScript function any expression can call by name, run by DuckDB per row. For logic the expression language has no words for; it returns a number, or an array of width numbers. Prefer an expression where one will do: DuckDB runs JS some 20 times slower than SQL.
Syntax
{ "id": "n1", "op": "js-function", "name": "js-function", "x": 0, "y": 0, "params": {} }
A parameter is set in params (leave out the ones at their default), driven by an edge to par:width, or read elsewhere as ch('js-function/width').
Inputs
This operator has no input ports.
Parameters
| Parameter | Kind | Default | Choices |
|---|---|---|---|
name | string | "fn" | |
params | string | "x" | |
width | int | 1 | |
body | code | "return x" |
Outputs
This operator has no outputs.
Details
- Category: Rows
- Operator:
js-function
Older projects
Projects saved before documents used operator classes. These convert to js-function when they open: AccessorOp.