Create a transform stream constructor from a function