reverse

import { reverse } from "jsr:@ende/text/unstable-reverse";

function · experimental

function reverse(input: string, options?: Partial<ReverseOptions>): string

Performs a Unicode-aware string reversal.

input: string

The input string to be reversed.

options?: Partial<ReverseOptions>

The options for the reverse function.

Returns

The reversed string.

Example: Standard usage

import { reverse } from "@ende/text/unstable-reverse";
import { assertEquals } from "@ende/assert";

assertEquals(reverse("Hello, world!"), "!dlrow ,olleH");
assertEquals(reverse("🦕Deno♥"), "♥oneD🦕");

Example: Performance optimization with disabled Unicode handling

import { reverse } from "@ende/text/unstable-reverse";
import { assertEquals } from "@ende/assert";

assertEquals(reverse("Hello, world!", { handleUnicode: false }), "!dlrow ,olleH");

Source