Just started using Ramda today in an attempt to learn/incorporate functional programming into my code by being more declarative, but I'm having trouble figuring out how to make this a bit more streamlined using pipes (or curry?) This is only used once so maybe I'm trying to hard.
Can anyone provide an explanation on how to trim this down so it looks less chaotic so I can get my head around FP? I seem to be only able to do this if I separate out each method and invoke separately like in the working example. The example was simplified for brevity.
Working Example
const logLevels: string[] = ['log', 'info', 'debug', 'error'];
// maps logLevels into pairs: [[log: f(x)], ['info': f(x)], ...]
const toPairs = (logLevel: string) => [logLevel, debug(`${process.env.APP_NAME}:${namespace}:${logLevel}`)];
const loggers: any = R.map(toPairs, logLevels);
// Then takes the pairs and makes it an object
// Output: { log: f(x), info: f(x), debug: f(x), ...}
this.debugger = R.fromPairs(loggers);
// Example Usage:
// this.debugger.log('...');