Skip to content

Commit 26787f2

Browse files
committed
- add toString api
- bump version
1 parent c5a45fa commit 26787f2

12 files changed

Lines changed: 1252 additions & 2145 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Logs
22

3+
## v0.3.0
4+
5+
- add `toString` api
6+
7+
38
## v0.2.0
49

510
- further minimize generated js file with mangling and compression

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ include csv4xls script, and use:
1414

1515
csv4xls provides following APIs:
1616

17-
* toArray(data) - convert given 2D array to an xls-compatible CSV file, stores in an Uint8Array and returns the array.
18-
* toBlob(data) - same as `toArray` but return a corresponding blob.
19-
* toHref(data) - same as `toBlob` but return a corresponding object url.
20-
* download(data, filename) - trigger file download
17+
- `toString(data)` - convert given 2D array to CSV in String format.
18+
- `toArray(data)` - convert given 2D array to an xls-compatible CSV file in thr returned Uint8Array.
19+
- `toBlob(data)` - same as `toArray` but return a corresponding blob.
20+
- `toHref(data)` - same as `toBlob` but return a corresponding object url.
21+
- `download(data, filename)` - trigger file download
2122

2223

2324
## Limitation

dist/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
(function(){
22
var obj, csv4xls;
33
obj = {
4-
toArray: function(data){
5-
var str, ba, i$, to$, i;
4+
toString: function(data){
5+
var str;
66
str = data.map(function(d, i){
77
return d.map(function(v, j){
88
return v + "";
99
}).join('\t');
1010
}).join('\r\n');
11-
str = data.map(function(d, i){
11+
return str = data.map(function(d, i){
1212
return d.map(function(v, j){
1313
return '"' + ('' + v).replace(/"/g, '""').replace(/\n/g, '\r') + '"';
1414
}).join('\t');
1515
}).join('\r\n');
16+
},
17+
toArray: function(data){
18+
var str, ba, i$, to$, i;
19+
str = obj.toString(data);
1620
ba = new Uint8Array(2 + str.length * 2);
1721
for (i$ = 0, to$ = str.length; i$ < to$; ++i$) {
1822
i = i$;

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)