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

Doc: Example output for writeToString() with transform() is wrong #64

Closed
TomGault opened this issue Sep 4, 2014 · 3 comments
Closed

Comments

@TomGault
Copy link

TomGault commented Sep 4, 2014

csv.writeToString(
    [
        {a: "a1", b: "b1"},
        {a: "a2", b: "b2"}
    ],
    {
        headers: true,
        transform: function (row) {
            return {
                A: row.a,
                B: row.b
            };
        }
    },
    function (err, data) {
        console.log(data); //"a,b\na1,b1\na2,b2\n"
    }
);

I believe console line should be:

        console.log(data); //"A,B\na1,b1\na2,b2\n"
@TomGault
Copy link
Author

TomGault commented Sep 4, 2014

Oh, also writeToPath() first parameter is missing. I believe:

writeToPath(arr[, options])

should be

writeToPath(path, arr[, options])

doug-martin added a commit to doug-martin/fast-csv that referenced this issue Sep 5, 2014
* Fixed issue with `writeToString` and `writeToPath` examples C2FO#64
* Fixed issue with creating a csv without headers C2FO#63
@doug-martin doug-martin mentioned this issue Sep 5, 2014
@doug-martin
Copy link
Contributor

Docs are updated! Thanks

-Doug

@TomGault
Copy link
Author

TomGault commented Sep 5, 2014

Thanks. Np!

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

2 participants