Currying in the real world
Samuel Pouyt
1352

You can define parse function above _.mapValues
And you can change parse params order, first is type, then is baseUrl. It will give you the ability to define two functions above _.mapValues.

// For example
const parsePreviewSchema = parse(‘preview’);
const parseStaticSchema = parse(‘static’);

And you will need to apply those functions inside _.mapValues callback

const parsePreview = parsePreviewSchema(baseUrl);
const parseStatic = parseStaticSchema(baseUrl);

I think it is yet another step to maintainable and performance code. Good luck!

Like what you read? Give Mikhail Novikov a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.