zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.71k stars 365 forks source link

Add promise support #75

Closed knownasilya closed 8 years ago

knownasilya commented 8 years ago

Might be worthwhile, but users can always do

var json2csv = Bluebird.promisify(require('json2csv'))
christianhaller commented 8 years ago

+1

knownasilya commented 8 years ago

I decided to leave this out, since it's simple enough to do. If the API was more complex with multiple methods, then maybe it would be worth it.

niftylettuce commented 7 years ago

We should re-open this @knownasilya since Promises are standard now, and frameworks such as Koa use it out of the box with async/await.

niftylettuce commented 7 years ago

In the meanwhile if anyone wants to do this:

const { promisify } = require('util');
const json2csv = require('json2csv');
const json2csvAsync = promisify(json2csv);
christianhaller commented 7 years ago

@niftylettuce super solution!

knownasilya commented 7 years ago

This library is sync, no promises necessary.