In this section, we are going to learn about some functional programming techniques that are very closely linked to function composition. We are going to learn about composition, partial application, currying, and pipes.
Composition techniques
Composition
Functional composition is a technique or pattern that allows us to combine multiple functions to create a more complex function.
The following code snippet declares two simple functions:
const trim = (s: string) => s.trim();
const capitalize = (s: string) => s.toUpperCase();
That two simple functions declared by the preceding code snippet are the following:
- A function used to trim a string
- A function used to transform a piece of text into uppercase
We can create a...