or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-8/

Unicode Code Point Adapter

Build a small module that translates between JavaScript strings and arrays of Unicode code points without losing surrogate pair information.

Capabilities

Convert text to code points

  • "Hi \\uD83D\\uDE00" yields [72, 105, 32, 128512] @test
  • "\\uD83Dabc" yields [55357, 97, 98, 99] preserving the lone surrogate half instead of dropping or replacing it @test

Convert code points to text

  • [0x48, 0x69, 0x20, 0x1F680] renders "Hi \\uD83D\\uDE80" @test
  • [0xD834, 0xDF06, 0xD800] renders "\\uD834\\uDF06\\uD800", combining valid pairs while leaving the unmatched half untouched @test

Preserve inputs

  • Converting [0xD83D, 0xDE03] returns "\\uD83D\\uDE03" without mutating the provided array after the call @test

Implementation

@generates

API

export function toCodePoints(input: string): number[];
export function fromCodePoints(codePoints: readonly number[]): string;

Dependencies { .dependencies }

punycode { .dependency }

Provides UCS-2/Unicode conversion helpers for bridging JS strings and code point arrays.