Docs: Add custom delimiter examples to lines.md#1229
Closed
vincent067 wants to merge 2 commits intosindresorhus:mainfrom
Closed
Docs: Add custom delimiter examples to lines.md#1229vincent067 wants to merge 2 commits intosindresorhus:mainfrom
vincent067 wants to merge 2 commits intosindresorhus:mainfrom
Conversation
added 2 commits
March 20, 2026 18:07
Add examples/ directory with four common use cases: - build-script.js: Build automation with error handling - git-helpers.js: Programmatic git operations - parallel-tasks.js: Running commands in parallel - stream-processing.js: Output filtering and transforms These examples help new users understand practical usage patterns beyond the basic documentation.
Add documentation and examples for using custom delimiters when splitting output, addressing issue sindresorhus#1210. Includes: - Array output with custom delimiter (null character example) - Progressive iteration with custom delimiter - Common delimiter examples (CSV, TSV, paragraph) Also fixes a minor syntax error in the iterable() example.
Collaborator
|
Hi @vincent067, Thanks for your contribution. It appears that this PR includes most of #1230, so could you remove the parts already included in the other PR? So we can review them at the same time, as opposed to one after the other? |
ehmicky
reviewed
Mar 20, 2026
| stdout: {transform: csvTransform, objectMode: true}, | ||
| })`echo "apple,banana,cherry,date"`; | ||
| console.log(items); // ['apple', 'banana', 'cherry', 'date'] | ||
| ``` |
Collaborator
There was a problem hiding this comment.
Those 3 examples are a little bigger in size and more specific than the other examples in our documentation, which are trying to explain the feature with as few lines as possible.
Would you please move them to the examples directory instead, then include some link to them from lines.md? Thanks!
Collaborator
|
Also, please make sure the CI tests are passing. Thanks! :) |
Owner
|
I'm going to close all of this as it's just AI-generated slop seemingly without any human review. |
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.
Hi there! 👋
This PR addresses issue #1210 by adding documentation for using custom delimiters when splitting subprocess output.
What's added
A new "Custom delimiters" section in
docs/lines.mdwith:Why this helps
The default newline-based splitting works for most cases, but users often need to process:
find -print0)The examples show how to combine
lines: falsewithobjectMode: truetransforms to handle these cases.Bonus fix
Also fixed a tiny syntax error in the
iterable()example (had an extra)).Let me know if you'd like any adjustments! Happy to iterate on this. 😊
Related: Closes #1210