diff options
Diffstat (limited to 'std/fs')
-rw-r--r-- | std/fs/eol.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/std/fs/eol.ts b/std/fs/eol.ts index 2f15be269..5ea554c6e 100644 --- a/std/fs/eol.ts +++ b/std/fs/eol.ts @@ -17,12 +17,9 @@ export function detect(content: string): EOL | null { if (!d || d.length === 0) { return null; } - const crlf = d.filter((x: string): boolean => x === EOL.CRLF); - if (crlf.length > 0) { - return EOL.CRLF; - } else { - return EOL.LF; - } + const hasCRLF = d.some((x: string): boolean => x === EOL.CRLF); + + return hasCRLF ? EOL.CRLF : EOL.LF; } /** Format the file to the targeted EOL */ |