I’m studying binance connector node code. I found this function in utils.js file:
const flowRight = (...functions) => input => functions.reduceRight(
(input, fn) => fn(input),
input
)
Who can explain me this code?
I’m studying binance connector node code. I found this function in utils.js file:
const flowRight = (...functions) => input => functions.reduceRight(
(input, fn) => fn(input),
input
)
Who can explain me this code?
Hey,
This function is designed to gather a list of modules, and the output is stored in a single class. For example, the class websocketAPI contains the functions of the following modules: Account, Market, Trade and userData.
Each modules in the array of modules called functions
is aggregated into a single value.
For additional details on the function reduceRight
, you can refer to this website.