I have some formatting functions that should be applied on some strings:
const limitSize = (limit: number): ((str: string) => string) => {
return (str: string) => str.substring(0, limit)
}
const replaceNewLine = (replaceWith: string): ((str: string) => string) => {
return (str: string) => str.replace(/\n/g, replaceWith)
}
They both return a function that can be applied on a string
How can I chain them together so that the result returns also a function that can be applied on strings?
Is there a lodash utility I'm missing?