Skip to content

Commit caa2697

Browse files
committed
Fixing bower issue
1 parent 54508cb commit caa2697

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

bower.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"moduleType": [
66
"node"
77
],
8+
"main": "lib/converter.js",
89
"license": "MIT",
910
"ignore": [
1011
"**/.*",

test.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Created by mrodrigues on 2/17/15.
3+
*/
4+
var Promise = require('bluebird'),
5+
converter = Promise.promisifyAll(require('./lib/converter'));
6+
7+
var documents = [
8+
{
9+
Make: 'Nissan',
10+
Model: 'Murano',
11+
Year: '2013',
12+
Specifications: {
13+
Mileage: '7106',
14+
Trim: 'S AWD'
15+
}
16+
},
17+
{
18+
Make: 'BMW',
19+
Year: '2014',
20+
Model: 'X5',
21+
Specifications: {
22+
Mileage: '3287',
23+
Trim: 'M'
24+
}
25+
}
26+
];
27+
28+
var csv = 'Make,Model,Year,Specifications.Mileage,Specifications.Trim\n' +
29+
'Nissan,Murano,2013,7106,S AWD\n' +
30+
'BMW,X5,2014,3287,M';
31+
32+
//converter.json2csv(documents, function (err, csv) {
33+
// if (!err) {
34+
// return console.log('csv', csv);
35+
// }
36+
// return console.log('err', err);
37+
// },
38+
// {
39+
// DELIMITER : {
40+
// FIELD : ',',
41+
// ARRAY : '/',
42+
// WRAP : '\"'
43+
// },
44+
// EOL : '\n',
45+
// PARSE_CSV_NUMBERS : false,
46+
// KEYS: ['Make', 'Model', 'Specifications.Mileage']
47+
// });
48+
49+
//converter.json2csvAsync(documents, {})
50+
// .then(function (csv) {
51+
// console.log('csv', csv);
52+
// })
53+
// .catch(function (err) {
54+
// console.log(err.stack);
55+
// });
56+
57+
converter.csv2json(csv, function (err, json) {
58+
if (!err) {
59+
return console.log('json', json);
60+
}
61+
return console.log('err', err);
62+
}, {KEYS: ['Model', 'Specifications.Mileage']});
63+
64+
//converter.csv2jsonAsync(csv, {})
65+
// .then(function (json) {
66+
// console.log('json', json);
67+
// })
68+
// .catch(function (err) {
69+
// console.log('err', err.stack);
70+
// })

0 commit comments

Comments
 (0)