Repository navigation
feat: support for multiline values [issue #33] - #295
Open
pgalbraith wants to merge 4 commits into
Open
pgalbraith wants to merge 4 commits into
pgalbraith wants to merge 4 commits into
Conversation
Issue npm#33 was closed as completed, but I think it was really rejected. This adds support for multine entries as requested in the issue, similar to the way Python configparser handles ini files. Multiline values are a convenience when you have a large value (e.g. a comma separated list) assigned to a single key. Breaking the value across several lines makes for much easier reading and maintenance.
- treat a value containing \r as ineligible for verbatim continuation lines, since the decoder drops a CR before LF and the win32 eol adds another, which made the encode snapshots platform-dependent - drop the \r from the modified foo.ini fixture value - add tests for the array-entry strict and legacy paths and for carriage returns, restoring 100% coverage - document the carriage-return rule for strictMultiline in the README
- write a value as indented continuation lines only when every line after the first is indented, non-blank, free of "=", not a comment, and the value has no carriage return; otherwise JSON-quote it - escape the first line with safe() like any other value - continue array entries in the decoder, matching what the encoder emits - clear the continuation state on any line that is not a comment or a continuation, including unparseable lines - default strictMultiline to false so stringify never throws where 7.0.0 did not; true still rejects values that cannot be written verbatim - restore the original foo.ini fixture value and add explicit round-trip tests for every case; document the rules in the README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #33 was closed as completed, but I think it was really rejected with a "submit a PR if you really need it" suggestion.
This adds support for multine entries as requested in the issue, similar to the way Python configparser handles ini files.
Multiline values are a convenience when you have a large value (e.g. a comma separated list) assigned to a single key. Breaking the value across several lines makes for much easier reading and maintenance.