Function detect

  • Returns the detected EOL character(s) detected in the input string. If no EOL character is detected, null is returned.

    Parameters

    • content: string

      The input string to detect EOL characters.

    Returns typeof EOL | null

    The detected EOL character(s) or null if no EOL character is detected.

    import { detect } from "@std/fs/eol";

    detect("deno\r\nis not\r\nnode"); // "\r\n"
    detect("deno\nis not\r\nnode"); // "\r\n"
    detect("deno\nis not\nnode"); // "\n"
    detect("deno is not node"); // null