feat(csv): add parseLine() convenience for single-line CSV records (refs #3765)#7114
Draft
MukundaKatta wants to merge 1 commit intodenoland:mainfrom
Draft
feat(csv): add parseLine() convenience for single-line CSV records (refs #3765)#7114MukundaKatta wants to merge 1 commit intodenoland:mainfrom
MukundaKatta wants to merge 1 commit intodenoland:mainfrom
Conversation
…ecords Adds a small synchronous helper that takes one CSV line and returns string[]. Useful when callers already have line-split input and don't need full document/stream semantics. Refs: denoland#3765
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7114 +/- ##
=======================================
Coverage 94.61% 94.61%
=======================================
Files 633 633
Lines 51777 51790 +13
Branches 9324 9330 +6
=======================================
+ Hits 48987 49000 +13
Misses 2216 2216
Partials 574 574 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Refs #3765. Adds
parseLine(line: string, options?: ParseLineOptions): string[]— a small synchronous convenience for single-record CSV input. Defaults to comma separator, no trim, strict quotes. Strips leading BOM and a single trailing CR/LF/CRLF.API
Documents the trade-off vs full
parse()—parseLinedoesn't continue multi-line quoted fields, doesn't validate field count across records, and doesn't honorcommentlines. For those useparse.Files changed
csv/parse.ts— newParseLineOptionsinterface andparseLine()function. Reuses internalParserclass. No breaking changes to existingparse()signature.csv/parse_test.ts— 12 new sub-steps covering basic parsing, quoting, escaped quotes, custom separator (TSV),trimLeadingSpace,lazyQuotes, trailing newline strip, BOM strip, error case, and return-type assertion.Test plan
deno fmt,deno lint,deno check,deno testall clean