Skip to main content

INTERNAL: The internal package for @std. Do not use this directly.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
94%
Published
4 months ago (1.0.5)
function buildMessage
buildMessage(
diffResult: ReadonlyArray<DiffResult<string>>,
): string[]

Builds a message based on the provided diff result.

Examples

Usage

import { diffStr, buildMessage } from "@std/internal";

const diffResult = diffStr("Hello, world!", "Hello, world");

console.log(buildMessage(diffResult));
// [
//   "",
//   "",
//   "    [Diff] Actual / Expected",
//   "",
//   "",
//   "-   Hello, world!",
//   "+   Hello, world",
//   "",
// ]

Parameters

diffResult: ReadonlyArray<DiffResult<string>>

The diff result array.

optional
options: BuildMessageOptions

Optional parameters for customizing the message.

Return Type

An array of strings representing the built message.

Add Package

deno add jsr:@std/internal

Import symbol

import { buildMessage } from "@std/internal/build-message";

---- OR ----

Import directly with a jsr specifier

import { buildMessage } from "jsr:@std/internal/build-message";

Add Package

npx jsr add @std/internal

Import symbol

import { buildMessage } from "@std/internal/build-message";

Add Package

yarn dlx jsr add @std/internal

Import symbol

import { buildMessage } from "@std/internal/build-message";

Add Package

pnpm dlx jsr add @std/internal

Import symbol

import { buildMessage } from "@std/internal/build-message";

Add Package

bunx jsr add @std/internal

Import symbol

import { buildMessage } from "@std/internal/build-message";