Type Alias StringifyOptions
arrayIndent?: boolean;
compatMode?: boolean;
condenseFlow?: boolean;
flowLevel?: number;
indent?: number;
lineWidth?: number;
schema?: SchemaType;
skipInvalid?: boolean;
sortKeys?: boolean | ((a: string, b: string) => number);
styles?: Record<string, StyleVariant>;
useAnchors?: boolean;
}
Type declaration
OptionalarrayIndent ?: booleanWhen true, adds an indentation level to array elements.
OptionalcompatMode ?: booleanIf false don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1.
OptionalcondenseFlow ?: booleanIf true flow sequences will be condensed, omitting the space between
key: valueora, b. Eg.'[a,b]'or{a:{b:c}}. Can be useful when using yaml for pretty URL query params as spaces are %-encoded.OptionalflowLevel ?: numberSpecifies level of nesting, when to switch from block to flow style for collections.
-1means block style everywhere.Optionalindent?: numberIndentation width to use (in spaces).
OptionallineWidth ?: numberSet max line width.
Optionalschema?: SchemaTypeName of the schema to use.
OptionalskipInvalid ?: booleanDo not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.
OptionalsortKeys ?: boolean | ((a: string, b: string) => number)If true, sort keys when dumping YAML in ascending, ASCII character order. If a function, use the function to sort the keys. If a function is specified, the function must return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise.
Optionalstyles?: Record<string, StyleVariant>Each tag may have own set of styles. - "tag" => "style" map.
OptionaluseAnchors ?: booleanIf false, don't convert duplicate objects into references.
Options for
stringify.