mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +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.
|
||||
// This module is browser compatible.
|
||||
|
||||
import {
|
||||
type FormattingOptions,
|
||||
IniMap,
|
||||
type ReplacerFunction,
|
||||
} from "./_ini_map.ts";
|
||||
import { IniMap, type ReplacerFunction } from "./_ini_map.ts";
|
||||
|
||||
/** 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.
|
||||
* Similar to the
|
||||
@ -18,7 +26,7 @@ export interface StringifyOptions extends FormattingOptions {
|
||||
replacer?: ReplacerFunction;
|
||||
}
|
||||
|
||||
export type { FormattingOptions, ReplacerFunction };
|
||||
export type { ReplacerFunction };
|
||||
|
||||
/**
|
||||
* Compile an object into an INI config string. Provide formatting options to modify the output.
|
||||
|
@ -18,10 +18,6 @@ Deno.test({
|
||||
fn() {
|
||||
assertValidStringify({ a: "b" }, `a=b`);
|
||||
assertValidStringify({ a: "b" }, `a = b`, { pretty: true });
|
||||
assertValidStringify({ a: "b" }, `a : b`, {
|
||||
assignment: ":",
|
||||
pretty: true,
|
||||
});
|
||||
assertValidStringify(
|
||||
{ a: "b", section: { c: "d" }, e: "f" },
|
||||
`a=b\ne=f\n[section]\nc=d`,
|
||||
|
Loading…
Reference in New Issue
Block a user