Functional composition is a mechanism to build complex functions by combining multiple simpler functions. This style can help you create more reusable functions in your code, reducing duplication, testing, and bugs.
A great example of designing for functional composition is the
lodash/fp is described as:
an instance of
lodash with its methods wrapped to produce immutable auto-curried iteratee-first data-last methods
Simple, right…? Let’s step through this bit by bit.
Immutable — These functions do not mutate their arguments, but produce new instances every time they are called.
... read the whole story at medium.com.