git-tweezers
Version:
Advanced git staging tool with hunk and line-level control
14 lines (13 loc) • 432 B
JavaScript
/**
* Helper to determine if a line has EOL based on raw diff content
*/
export function hasEOL(line, isLastLine, nextLine) {
// If it's not the last line, it has EOL
if (!isLastLine)
return true;
// If the next line is "\ No newline at end of file", this line doesn't have EOL
if (nextLine?.startsWith('\\ No newline at end of file'))
return false;
// Otherwise, it has EOL
return true;
}