Filter Functions

Filter functions in Workflow Playbook

A filter function transforms value(s) into another. The values from a filter function can be piped into another function. Each value that is left-hand side of the pipe | is considered as the first argument of the filter function.

"{{ firstArg | filterFunc(sencondArg, thirdArg) | anotherFilterFunc(...) }}"

By piping with these filter functions, we can perform multiple value transformations as well as special functions in one single line. This is originally designed for web templates (the Nunjucks template). We adopted it here to describe a task. So, the built-in filter functions are all available. In addition, we also provide many special filter functions that are commonly used to define tasks in a workflow.

Built-in filter functions in Nunjucks template engines

The Nunjucks template engine has defined a set of built-in filter functions.

Ported filter functions from the lodash library

The original built-in filter functions in the Nunjucks template engines may not be enough to specify task arguments. Hence, we ported the whole lodash library into the default filter functions of Workflow Playbook. With the lodash library,

How to customize filter functions