fuseFindByKey is a helper pipe that finds entries from an object using given key-source set.
Consider this array of objects representing the tags and tasks data stored on the backend:
Normally, you would join these two data together in the backend before sending it to the frontend so you can access tags of a task right from the task itself:
But, let's say you cannot join them. You have no access to the backend app or you cannot make any changes to it and you have to work with what you have. In
this case, you can use the fuseFindByKey
pipe to get the tags of a task without joining the two data using javascript:
The above code will iterate through the tasks, and for each task, it will also iterate the task's tags.
task.tags
array normally holds the ids of the assigned tags. But using fuseFindByKey
pipe, we can use those ids to
extract the actual tag object from the tags array.