max-mapper / max-mapper/ldjson-csv

Ability to skip ldjson-stream serialization?

Open
#2 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
14
Forks
4
PR merge metrics
No merged PRs in 30d

Description

At present the module always serializes objects back to strings using JSON.stringify such that the example code of:

fs.createReadStream('data.csv')
  .pipe(require('ldjson-csv')())
  .on('data', function(obj) {
    // obj is a javascript object
  })

Is actually:

fs.createReadStream('data.csv')
  .pipe(require('ldjson-csv')())
  .on('data', function(obj) {
    // obj is a serialized JSON string
  })

In my particular use case, I really wanted the object and reparsing the JSON seems a little inefficient (although it would be ok in my case). I'm wondering if you'd except a PR for me to make the serialization optional, such that:

fs.createReadStream('data.csv')
  .pipe(require('ldjson-csv')({ stringify: false }))
  .on('data', function(obj) {
    // obj is a javascript object
  })

would work...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the module entry point used by require('ldjson-csv')() and trace where parsed objects are serialized with JSON.stringify. Verify that stringify:false emits JavaScript objects while the default retains the current serialized-string behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-engineering
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.