###* Pipe the input through each function in the array in turn. For example, if you have a list of objects you can perform a series of selection, sorting, and other processing methods and then receive the processed list. This array must contain functions that accept a single input and return the processed input. The output of the first function is fed to the input of the second and so on until the final processed output is returned. @name pipeline @methodOf Array# @param {Object} input The initial input to pass to the first function in the pipeline. @returns {Object} The result of processing the input by each function in the array. ### Array::pipeline = (input) -> for fn in this input = fn(input) return input
The main use for this is in the PixieEngine cameras module where we need to process the camera transform with a stream of modifiers. This also allows for the game objects list to be z-sorted, filtered to a subset that passes a clip test, or any other arbitrary stream filter.
I think this is probably some sort of fundamental concept of functional programming, but I’m not sure if `pipeline` is the right name. If anyone has historic info on this please let me know.