Skip to main content
Home
This release is 28 versions behind 1.0.16 — the latest version of @std/assert. Jump to latest

@std/assert@0.219.0
Built and signed on GitHub Actions

Common assertion functions, especially useful for testing

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 years ago (0.219.0)
Package root>_format.ts
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. // This file been copied to `std/expect`. /** * Converts the input into a string. Objects, Sets and Maps are sorted so as to * make tests less flaky * @param v Value to be formatted */ export function format(v: unknown): string { // deno-lint-ignore no-explicit-any const { Deno } = globalThis as any; return typeof Deno?.inspect === "function" ? Deno.inspect(v, { depth: Infinity, sorted: true, trailingComma: true, compact: false, iterableLimit: Infinity, // getters should be true in assertEquals. getters: true, strAbbreviateSize: Infinity, }) : `"${String(v).replace(/(?=["\\])/g, "\\")}"`; }