DataJet
Search…
apply
apply is used to call a function. The argument before the pipe becomes function_input, and argument after colon is function name.

Example

Let's assume we have simple function called hello_world defined with below code.
1
{% assign input = function_input %}
2
{% assign input["foo"] = "bar" %}
3
{% global function_output = input %}
Copied!
Now, you can call this function in hooks code using apply filter:
1
{% assign fn_input = '{"foo": ""}' | parse %}
2
{% assign fn_result = fn_input | apply: "hello_world" %}
Copied!
As a result, value of fn_result will be:
1
{
2
"foo": "bar"
3
}
Copied!
Last modified 1yr ago
Copy link
Contents