Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError at Object.keys #50

Closed
earthquakesan opened this issue Jul 29, 2014 · 5 comments
Closed

TypeError at Object.keys #50

earthquakesan opened this issue Jul 29, 2014 · 5 comments

Comments

@earthquakesan
Copy link

This snippet does not work in webkit (desktop app):

var csvStream = csv
    .createWriteStream({headers: true})
    .transform(function(row){
        return {
           A: row.a,
           B: row.b
        };
    }),
    writableStream = fs.createWriteStream("my.csv");

writableStream.on("finish", function(){
  console.log("DONE!");
});

csvStream.pipe(writableStream);
csvStream.write({a: "a0", b: "b0"});
csvStream.write({a: "a1", b: "b1"});
csvStream.write({a: "a2", b: "b2"});
csvStream.write({a: "a3", b: "b4"});
csvStream.write({a: "a3", b: "b4"});
csvStream.write(null);

My stacktrace:

TypeError
    at Object.keys (/home/ivan/Workspace/js/neuroskyvis/app/node_modules/fast-csv/node_modules/object-extended/index.js:116:23)
    at CsvTransformStream.extended.extend.write (/home/ivan/Workspace/js/neuroskyvis/app/node_modules/fast-csv/lib/formatter.js:126:51)
    at HTMLInputElement.<anonymous> (file:///home/ivan/Workspace/js/neuroskyvis/app/dist/app.min.js:121:19)
    at HTMLInputElement.jQuery.event.dispatch (file:///home/ivan/Workspace/js/neuroskyvis/app/dist/vendor.min.js:4409:9)
    at HTMLInputElement.elemData.handle (file:///home/ivan/Workspace/js/neuroskyvis/app/dist/vendor.min.js:4095:28)

I'm falling back to csv module for now.

@TimNZ
Copy link

TimNZ commented Aug 22, 2014

There is a isHash(obj) function in is-extended node_module that includes a 'obj.constructor === Object' check, this is likely returning false, as it does in my case.

@TimNZ
Copy link

TimNZ commented Aug 22, 2014

I'm using fastcsv in a script running in a node js VM, as far as I can tell the Objects are subsequently different between VM and outside. Odd, and an incredibly annoying quirk.

@doug-martin
Copy link
Contributor

Sorry about that, I've ran into this issue before when running in a VM with other libraries. However, I have this fixed and will be in the next release v0.5.0 which should be out hopefully tomorrow or this weekend.

-Doug

@TimNZ
Copy link

TimNZ commented Aug 22, 2014

Thanks Doug, love the fast response.

Used array format as temp fix.

@doug-martin
Copy link
Contributor

This should be fixed in v0.5.0 if you have anymore issues please let me know!

-Doug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants