Skip to main content
Module

x/lume/deps/fs.ts>detect

🔥 Static site generator for Deno 🦕
Very Popular
Latest
function detect
import { detect } from "https://deno.land/x/lume@v2.1.4/deps/fs.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.224.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.