Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
) => (
patterns: AlternatePattern.t[]
): ResultP => {
return pipeAsync(
patterns,
R.map(AlternatePattern.alternatePath(userFilePath, projectionsPath)),
paths => R.compact(paths) as string[],
File.findExisting,
mapError((alternatesAttempted: string[]) => ({
alternatesAttempted,
message: `No alternate found for ${userFilePath}. Tried: ${alternatesAttempted}`,
startingFile: userFilePath
}))
);
};
export const findExisting = async (filePaths: t[]): ResultP => {
return pipeAsync(
filePaths,
R.map(fileExists),
files => Promise.all(files),
file => firstOk(file),
mapError(always(filePaths))
);
};