温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/YAML/stringify
点击访问原文链接

function stringify | Bun module | Bun

function stringify | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/YAML/stringifyFstringify

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/YAML/stringifyFstringify

function

YAML.stringifyfunction stringify(input: unknown,replacer?: null,space?: string | number): string;

Convert a JavaScript value into a YAML string. Strings are double quoted if they contain keywords, non-printable or escaped characters, or if a YAML parser would parse them as numbers. Anchors and aliases are inferred from objects, allowing cycles.

@param input

The JavaScript value to stringify.

@param replacer

Currently not supported.

@param space

A number for how many spaces each level of indentation gets, or a string used as indentation. Without this parameter, outputs flow-style (single-line) YAML. With this parameter, outputs block-style (multi-line) YAML. The number is clamped between 0 and 10, and the first 10 characters of the string are used.

@returns

A string containing the YAML document.

import { YAML } from "bun";

const input = {
abc: "def",
num: 123
};

// Without space - flow style (single-line)
console.log(YAML.stringify(input));
// {abc: def,num: 123}

// With space - block style (multi-line)
console.log(YAML.stringify(input, null, 2));
// abc: def
// num: 123

const cycle = {};
cycle.obj = cycle;
console.log(YAML.stringify(cycle, null, 2));
// &1
// obj: *1

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

function stringify | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for function bun.YAML.stringify | Bun