mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
BREAKING(ini): reduce options for stringify
, make FormattingOptions
type private (#5572)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
parent
3a446538b1
commit
aa8bb2b28b
@ -1,14 +1,22 @@
|
|||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
// This module is browser compatible.
|
// This module is browser compatible.
|
||||||
|
|
||||||
import {
|
import { IniMap, type ReplacerFunction } from "./_ini_map.ts";
|
||||||
type FormattingOptions,
|
|
||||||
IniMap,
|
|
||||||
type ReplacerFunction,
|
|
||||||
} from "./_ini_map.ts";
|
|
||||||
|
|
||||||
/** Options for {@linkcode stringify}. */
|
/** Options for {@linkcode stringify}. */
|
||||||
export interface StringifyOptions extends FormattingOptions {
|
export interface StringifyOptions {
|
||||||
|
/**
|
||||||
|
* Character(s) used to break lines in the config file.
|
||||||
|
*
|
||||||
|
* @default {"\n"}
|
||||||
|
*/
|
||||||
|
lineBreak?: "\n" | "\r\n" | "\r";
|
||||||
|
/**
|
||||||
|
* Use a plain assignment char or pad with spaces.
|
||||||
|
*
|
||||||
|
* @default {false}
|
||||||
|
*/
|
||||||
|
pretty?: boolean;
|
||||||
/**
|
/**
|
||||||
* Provide custom string conversion for the value in a key/value pair.
|
* Provide custom string conversion for the value in a key/value pair.
|
||||||
* Similar to the
|
* Similar to the
|
||||||
@ -18,7 +26,7 @@ export interface StringifyOptions extends FormattingOptions {
|
|||||||
replacer?: ReplacerFunction;
|
replacer?: ReplacerFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { FormattingOptions, ReplacerFunction };
|
export type { ReplacerFunction };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile an object into an INI config string. Provide formatting options to modify the output.
|
* Compile an object into an INI config string. Provide formatting options to modify the output.
|
||||||
|
@ -18,10 +18,6 @@ Deno.test({
|
|||||||
fn() {
|
fn() {
|
||||||
assertValidStringify({ a: "b" }, `a=b`);
|
assertValidStringify({ a: "b" }, `a=b`);
|
||||||
assertValidStringify({ a: "b" }, `a = b`, { pretty: true });
|
assertValidStringify({ a: "b" }, `a = b`, { pretty: true });
|
||||||
assertValidStringify({ a: "b" }, `a : b`, {
|
|
||||||
assignment: ":",
|
|
||||||
pretty: true,
|
|
||||||
});
|
|
||||||
assertValidStringify(
|
assertValidStringify(
|
||||||
{ a: "b", section: { c: "d" }, e: "f" },
|
{ a: "b", section: { c: "d" }, e: "f" },
|
||||||
`a=b\ne=f\n[section]\nc=d`,
|
`a=b\ne=f\n[section]\nc=d`,
|
||||||
|
Loading…
Reference in New Issue
Block a user