import { pipe } from 'rambda';
function readFile(filePath) { // reading the file return fileContents }
function editFile(fileContents) { // edit the file return newFileContents }
function writeFile(fileContents, filePath) { // write content }
function manipulateFile(filePath) {
return writeFile(pipe(readFile, editFile)(filePath))(filePath);
}
is there any way to avoid filePath
argument duplication in manipulateFile
?
Ideally I would like to pipe it like this. But filePath
will be not provided to writeFile
function manipulateFile(filePath) {
return pipe(
readFile,
editFile,
writeFile
)(filePath)
}