Skip to main content
Module

x/enzastdlib/vendor/@deno-std-fs.ts>detect

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
function detect
import { detect } from "https://deno.land/x/enzastdlib@v0.0.4/vendor/@deno-std-fs.ts";

Detect the EOL character for string input. returns null if no newline.

Examples

Example 1

import { detect, EOL } from "https://deno.land/std@0.224.0/fs/mod.ts";

const CRLFinput = "deno\r\nis not\r\nnode";
const Mixedinput = "deno\nis not\r\nnode";
const LFinput = "deno\nis not\nnode";
const NoNLinput = "deno is not node";

detect(LFinput); // output EOL.LF
detect(CRLFinput); // output EOL.CRLF
detect(Mixedinput); // output EOL.CRLF
detect(NoNLinput); // output null

Parameters

content: string

Returns

EOL | null