MCPcopy Create free account
hub / github.com/denoland/std / format

Function format

internal/format.ts:36–55  ·  view source on GitHub ↗
(v: unknown)

Source from the content-addressed store, hash-verified

34 * ```
35 */
36export function format(v: unknown): string {
37 // deno-lint-ignore no-explicit-any
38 const { Deno, process } = globalThis as any;
39
40 const inspect: InspectFn | undefined = Deno?.inspect ??
41 process?.getBuiltinModule?.("node:util")?.inspect;
42
43 return typeof inspect === "function"
44 ? inspect(v, {
45 depth: Infinity,
46 sorted: true,
47 trailingComma: true,
48 compact: false,
49 iterableLimit: Infinity,
50 // getters should be true in assertEquals.
51 getters: true,
52 strAbbreviateSize: Infinity,
53 })
54 : basicInspect(v);
55}
56
57const formatters: ((v: unknown) => string | undefined)[] = [
58 (v) => {

Callers 2

format_test.tsFile · 0.90
fnFunction · 0.90

Calls 1

basicInspectFunction · 0.85

Tested by

no test coverage detected