So I have a problem, I have two functions in ramda.js, they look like this:
const getDayName = flip(nth)(['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'])
const formatDay = ifElse(isNil, always(''), pipe(dec, getDayName, i18n.t('views.routing.dialogs.${__}')))
The first function returns name of the day by it's index, and second accepts id of day, if it's null it returns empty string, otherwise it decreaces id by 1, because index starts from 0 and id starts from 1.
Then it passes it through pipe to getDayName, returns day name, and then uses day name in i18n.t function, which is used for translating day using day name as a key
But I have a problem, when i use this function i get an error from ramda: g.call is not a function, I think this error comes from the i18n.t() in pipe, how could I fix it?
I can't pass arguments in pipe explicitly, like dayName => ..., so I should only use R.__ placeholder from ramda
R.pipeexpects functions, and addingR.__to a template string doesn't convert it to a function.Create a
translatefunction that wrapsi18n.t(), and calls it with thedayName:And use it in the pipe: