Duaer

Expressions and code

Use built-in methods and variables in Duaer

Duaer's built-in methods and variables for working with data in expressions. The Code node runs plain JavaScript and native Luxon.

Expressions and the Code node are not the same engine

The expression editor can use $json, $("Node name"), $now, $if(), and transformation methods on strings, arrays, and dates. The Code node does not use that expression engine.

If the Code node says is not a function, check whether the method exists only in expressions. Date formatting can use format() in an expression; in the Code node, use Luxon’s toFormat(). plus() and minus() accept (amount, unit) in an expression; in the Code node they expect an object such as { days: 7 }. The expression-style call may not throw in the Code node, and still not do what you meant.

$if(), $ifEmpty(), and $jmespath() exist only in expressions. The lookup is Methods and variables reference for Duaer.

Which page to open

Questions

Can Duaer transformation methods run in the Code node?

Duaer transformation methods, $if(), and $jmespath() belong to expressions. The Code node runs plain JavaScript and native Luxon. Use toFormat() instead of format(), and plus({ days: 7 }) instead of plus(7, "days").

Which Duaer variable reads the current item?

In a Duaer expression, the current item is $json and its file is $binary. An earlier node is $("Node name").item, first(), last(), or all().

In this section