format

import { format } from "jsr:@ende/fs";

function

function format(content: string, eol: typeof EOL): string

Normalize the input string to the targeted EOL.

content: string

The input string to normalize.

eol: typeof EOL

The EOL character(s) to normalize the input string to.

Returns

The input string normalized to the targeted EOL.

Example: Usage

import { LF, format } from "@ende/fs/eol";
import { assertEquals } from "@ende/assert";

const CRLFinput = "deno\r\nis not\r\nnode";

assertEquals(format(CRLFinput, LF), "deno\nis not\nnode");

Source