feat: add default delimiter map

This commit is contained in:
Johann Schopplich
2025-10-25 09:58:11 +02:00
parent f879f88dff
commit 7d4bb889f5
3 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
// #region JSON types
import type { Delimiter, DelimiterKey } from './constants'
export type JsonPrimitive = string | number | boolean | null
export type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined }
export type JsonArray = JsonValue[] | readonly JsonValue[]
@@ -9,6 +11,8 @@ export type JsonValue = JsonPrimitive | JsonObject | JsonArray
// #region Encoder options
export type { Delimiter, DelimiterKey }
export interface EncodeOptions {
/**
* Number of spaces per indentation level.
@@ -17,9 +21,9 @@ export interface EncodeOptions {
indent?: number
/**
* Delimiter to use for tabular array rows and inline primitive arrays.
* @default ','
* @default DELIMITERS.comma
*/
delimiter?: ',' | '\t' | '|'
delimiter?: Delimiter
}
export type ResolvedEncodeOptions = Readonly<Required<EncodeOptions>>