Constructors§
Source§new ExpressionBuilder<
T extends ChainContext = any,
Path extends string = any,
TCurr = TypeOfField<Path, T>,
>(
path: Path,
methodCalls?: string[],
options?: ExpressionBuilderOptions,
): ExpressionBuilder<T, Path, TCurr>
new ExpressionBuilder<
T extends ChainContext = any,
Path extends string = any,
TCurr = TypeOfField<Path, T>,
>(
path: Path,
methodCalls?: string[],
options?: ExpressionBuilderOptions,
): ExpressionBuilder<T, Path, TCurr>
Properties§
§
filter: TCurr extends TElem[]
? (predicate: (item: TElem) => boolean) => this
: "Expected array "...§find: TCurr extends TElem[]
? (
predicate: (item: TElem) => boolean,
) => ExpressionBuilder<T, `${Path}[${number}]`>
: "Expected array "...§first: TCurr extends any[]
? () => ExpressionBuilder<T, `${Path}[${number}]`>
: "Expected array "...§join: TCurr extends any[]
? (
separator: string,
) => ExpressionBuilder<any, any, string>
: "Expected array "...§last: TCurr extends any[]
? () => ExpressionBuilder<T, `${Path}[${number}]`>
: "Expected array "...§split: TCurr extends string
? (
separator: string,
) => ExpressionBuilder<any, any, string[]>
: "Expected string "...§to Json String: { ... }...§to Lower Case: TCurr extends string ? () => this : "Expected string "...§to Upper Case: TCurr extends string ? () => this : "Expected string "...§trim: TCurr extends string ? () => this : "Expected string "...§public readonly type: TCurr...Methods§
Source§apply<TOutput = unknown>(
fn: (value: TCurr) => TOutput,
): ExpressionBuilder<T, Path, TOutput>
apply<TOutput = unknown>(
fn: (value: TCurr) => TOutput,
): ExpressionBuilder<T, Path, TOutput>
Apply an arbitrary transform function to the current value.
The function body is parsed and converted into a chain of method calls. The parameter type is inferred from the current field type, and the output type is inferred from the function's return type.
Example:
$("json.text").apply(text => text.toUpperCase().split(" ").join("-"))
// Results in: "={{ $json.text.toUpperCase().split(' ').join('-') }}"
Notes:
- The input parameter of the function is typed as the current field type (
TCurr). - The resulting ExpressionBuilder's output type will be inferred from the function return type.
- Not all JS globals or helper functions may be available inside n8n expression evaluation.
Source§call(
methodName: string,
...args: any[],
): ExpressionBuilder<T, any>
call(
methodName: string,
...args: any[],
): ExpressionBuilder<T, any>
Arbitrary method call
The type of the current field Should only be used with
typeofReturns null.