Conditional Function Application in a Pipe
I often happen to need to apply conditionally a function in a pipe. For instance:
So I finally created an iif function:
So now I can write:
But I have a feeling there could be a cleverer solution? Maybe with options?
pipe(ReadonlyArray.make(3, 6, 4), (arr) => (options.sort ? ReadonlyArray.sort(arr, Order.number) : arr));So I finally created an iif function:
So now I can write:
pipe(ReadonlyArray.make(3, 6, 4), iif(()=>options.sort,ReadonlyArray.sort(Order.number));But I have a feeling there could be a cleverer solution? Maybe with options?
