Repository navigation
v3.2.0
Added
- Packaging: Ship an edit-only
patch-litedistribution that updates existing values while preserving comments formatting. (#309) - Patching: accept smol-toml date objects when patching and stringifying values. (#309)
- Formatting: Add
escapeSequenceUpperCaseoption toTomlFormatto control the case of generated hex escape sequences. When patching, the case is auto-detected from the first hex escape in the document. (#309) - Patching: keep the sign of a negative zero. Editing a value to
-0writes it as-0.0instead of leaving the existing zero in place. (#309)
Changed
- Stringify: Improve stringification performance for inline arrays and tables that fit on one line (#314)
Fixed
- Patching: preserve the number formatting of edited values. Floats with an explicit zero fraction keep their decimal places (
1.0->2.0,1.00->2.00), exponent notation is kept when the source used it (1.0e10->1.0e11), and floats with a non-zero fraction collapse to a plain integer when their value becomes whole (1.5->2,1.25e10->1e11).minimumDecimalsstill forces the requested decimal places. (#309) - Patching: preserve underscore grouping in integer literals, counted from the right, when the value changes (
1_000_000->10000becomes10_000). (#309) - Patching: preserve hexadecimal, octal and binary integer notation (
0x,0o,0b) and the exponent marker case (evsE) when editing numbers. (#309) - Patching: fall back to a multiline literal (
'''...''') or a basic string when an edited literal string value cannot be written literally, instead of emitting TOML that the parser rejects. (#309) - Patching: keep escape sequences that are string content intact when writing basic strings. A value holding text such as
\u000cwas written back as\u000C, changing the value, in bothpatch()andstringify(). (#309) - Patching: escape a standalone carriage return written into a multiline basic string, instead of emitting a raw CR that the parser rejects when the document is read back. (#309)
- Patching: keep a leading newline in an edited multiline string. (#309)
- Patching: keep the raw form of
inf,nanand-0when the edited value came from a document that used exponent notation. (#309) - Escape sequences: do not take the document's escape sequence case from escaped content such as the text
\uabcd. (#309) - Patching: keep the sign of a negative NaN reliably. The sign was read through a typed array that occasionally loses it, so
patch()orstringify()could writenanwhere the value was-nan. (#309)
Full Changelog: v3.1.2...v3.2.0
Version specific links
| Registry | Link |
|---|---|
| https://www.npmjs.com/package/@decimalturn/toml-patch/v/3.2.0 | |
| https://jsr.io/@decimalturn/toml-patch@3.2.0 |