https://github.com/jwerle/to-csv
Convert objects to CSV
https://github.com/jwerle/to-csv
Last synced: about 1 year ago
JSON representation
Convert objects to CSV
- Host: GitHub
- URL: https://github.com/jwerle/to-csv
- Owner: jwerle
- License: mit
- Created: 2013-08-06T19:32:24.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2016-04-18T12:11:36.000Z (about 10 years ago)
- Last Synced: 2025-04-14T07:54:02.523Z (about 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 13
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
to-csv
=====
Convert objects to CSV format
## install
```sh
$ component install jwerle/to-csv
```
## api
### csv(array, opts)
Accepts an array of objects and converts them to CSV format
## example
```js
var data = [];
for (var i = 0; i < 10; ++i) {
data.push({
id: Math.random().toString(16).slice(2),
value: data.length % 2
});
}
console.log(csv(data));
/**
id,value
22dd67dd,0
8d18327,1
adfcb2bb,0
5424635b,1
f8049525,0
49493c6d,1
af99d0f1,0
d9f82d24,1
e7f38d52,0
47ef5c67,1
**/
```
## License
MIT