Skip to main content
Module

std/fs/mod.ts>detect

The Deno Standard Library
Latest
function detect
import { detect } from "https://deno.land/std@0.223.0/fs/mod.ts";

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

Examples

Example 1

import { detect } from "https://deno.land/std@0.223.0/fs/eol.ts";

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

Parameters

content: string

The input string to detect EOL characters.

Returns

EOL | null

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