Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions yaml/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ export type StringifyOptions = {
* @default {false}
*/
condenseFlow?: boolean;
/**
* Strings will be quoted using this quoting style.
* If you specify single quotes, double quotes will still be used
* for non-printable characters.
*
* @default {`'`}
*/
quoteStyle?: "'" | '"';
};

/**
Expand Down
6 changes: 3 additions & 3 deletions yaml/stringify_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,15 @@ Deno.test({
});

Deno.test({
name: "(unstable) stringify() handles quoteStyle",
name: "stringify() handles quoteStyle",
fn() {
const object = { url: "https://example.com" };
assertEquals(
unstableStringify(object, { quoteStyle: '"' }),
stringify(object, { quoteStyle: '"' }),
`url: "https://example.com"\n`,
);
assertEquals(
unstableStringify(object, { quoteStyle: "'" }),
stringify(object, { quoteStyle: "'" }),
`url: 'https://example.com'\n`,
);
},
Expand Down
9 changes: 0 additions & 9 deletions yaml/unstable_stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ export type { ImplicitType, KindType, RepresentFn, SchemaType, Type };

/** Options for {@linkcode stringify}. */
export type StringifyOptions = StableStringifyOptions & {
/**
* Strings will be quoted using this quoting style.
* If you specify single quotes, double quotes will still be used
* for non-printable characters.
*
* @default {`'`}
*/
quoteStyle?: "'" | '"';

/**
* Extra types to be added to the schema.
*/
Expand Down
Loading