Introduction
Value Pipes are functions responsible for modification of values generated by Value Generators.
What really Value Pipes are
Each Value Pipe can be described as this:
Simply put, it's technically just a function performing a modification to the generated value.
In other words, the Value pipe is only performing some post-generation modifications to the value. In the end, this modified value is then returned as the result of the Value Generator.
How to use Value Pipes
Value Pipes are defined as a part of Value Generator configuration; just after the Value Generator creates the value, it checks there are any Value pipes defined and if so, it pipes it through all of them, one by one.
Value Generator Configuration with Pipes
Tip
This example uses Constant Value Generator. You may want to check it out
Note
Specifying the Value Pipes is optional. When none is provided, the Value Generator simply returns the value it generated.
On the other hand, when you specify it, keep in mind that an array
of functions
is expected.
As you can see above, the pipes can be organized into a one multistep pipeline updating the generated value
Order matters
Watch out! The order of the Value Pipes matter; when you don't keep this in mind, you can get into trouble very soon!
Custom Value Pipes
You may easily find yourself in situation when you can't find any predefined Value Pipe doing what you need. Then, it would be nice to define your own custom pipe doing exactly what you need, right?
Single-purpose Value Pipe
As you can see above, the Value pipe is simply just a function taking a value and returning a modified one. No big deal.
When you need, you can pass this to configuration of a Value Generator and it will try to use it.
Single-purpose Value Pipe Example
Tip
This example uses Constant Value Generator. You may want to check it out
Registration of Custom Value Pipes
However, at some places, you might think that some functions are kind of repetetive and you need to use the very same at many places.
For this reason, you can register your Value Pipe into the Falbricate internal ecosystem with a name assigned to it. Then, you only refer to your pipe just the same as you do to get some of the predefined ones.
Registration of a Custom Value Pipe
Unique names
Keep in mind the names has to be unique! When you try to use a name that is already reserved for another Value Pipe, it ends up in an Error!
When you define your custom pipe, then you can use it anywhere you want.
Using of a Custom Value Pipe
Tip
This example uses Constant Value Generator. You may want to check it out