Skip to content

Commit 7a6f1a4

Browse files
committed
Churn
Lint and remove excess/unnecessary code
1 parent 0d94c47 commit 7a6f1a4

14 files changed

+17
-93
lines changed

examples/esm-usage.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as csv from 'jquery-csv';
2-
import * as fs from 'fs';
3-
2+
import * as fs from 'fs';
43

54
let sample = './data/sample.csv';
65
fs.readFile(sample, 'UTF-8', (err, fileContent) => {

examples/flot.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h2>Enjoy...</h2>
4242
<div id="tabs-2">
4343
<p>To use this demo, simply paste your dataset into the text area and hit the 'Run' button.</p>
4444
<hr />
45-
<textarea id="textInput" style="height:150px;">0,0.5
45+
<textarea id="text-input" style="height: 150px;">0,0.5
4646
0.01,0.5313952597646567
4747
0.02,0.5626666167821521
4848
0.03,0.5936906572928623
@@ -151,9 +151,9 @@ <h2>Enjoy...</h2>
151151
<p>Note: This demo is capable of processing and loading multiple data files. Just select more than one file in the dialog.</p>
152152
<p>I suggest you try loading the <a href="https://raw.githubusercontent.com/evanplaice/jquery-csv/master/examples/data/analytics1.csv">analytics1.csv</a> and <a href="https://raw.githubusercontent.com/evanplaice/jquery-csv/master/examples/data/analytics2.csv">analytics2.csv</a> data sets together.</p>
153153
<hr />
154-
<input id="fileInput" type="file" name="files[]" multiple />
154+
<input id="file-input" type="file" name="files[]" multiple />
155155
<hr />
156-
<div id="flot2" style="width:600px;height:300px;margin:0 auto;"></div>
156+
<div id="flot2" style="width: 600px; height: 300px; margin: 0 auto;"></div>
157157
</div>
158158
</div>
159159

@@ -168,7 +168,7 @@ <h2>Enjoy...</h2>
168168

169169
$(document).ready(function() {
170170
if(isAPIAvailable()) {
171-
$('#fileInput').bind('change', handleFileSelect);
171+
$('#file-input').bind('change', handleFileSelect);
172172
}
173173

174174
flotTextData();
@@ -200,7 +200,7 @@ <h2>Enjoy...</h2>
200200
}
201201

202202
var data1 = [];
203-
data1[0] = $.csv.toArrays($('#textInput').val(), {
203+
data1[0] = $.csv.toArrays($('#text-input').val(), {
204204
onParseValue: $.csv.hooks.castToScalar
205205
});
206206
flot1 = $.plot($('#flot1'), data1, options);

examples/google-visualization.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ <h2>Enjoy...</h2>
3939
<div id="tabs-2">
4040
<p>To use this demo, simply paste your dataset into the text area and hit the 'Run' button.</p>
4141
<hr />
42-
<textarea id="textInput" style="height:150px;">"TimeStamp (ms)","MID 128|PID 91|Accelerator pedal position (%)","MID 128|PID 92|Engine load(%)","MID 128|PID 100|Engine oil pressure (bar)","MID 128|PID 105|Intake manifold temperature (N0C)","MID 128|PID 110|Engine coolant temperature (N0C)","MID 128|PID 190|Engine speed (r/min)"
42+
<textarea id="text-input" style="height:150px;">"TimeStamp (ms)","MID 128|PID 91|Accelerator pedal position (%)","MID 128|PID 92|Engine load(%)","MID 128|PID 100|Engine oil pressure (bar)","MID 128|PID 105|Intake manifold temperature (N0C)","MID 128|PID 110|Engine coolant temperature (N0C)","MID 128|PID 190|Engine speed (r/min)"
4343
115,10.4,0,0,0,0,0
4444
175,,40,,,,
4545
309,,,4.55,,,
@@ -126,7 +126,7 @@ <h2>Enjoy...</h2>
126126

127127
function chartTextData() {
128128
$('#padding1').css({visibility: "visible"});
129-
var csv = $('#textInput').val();
129+
var csv = $('#text-input').val();
130130
var parsedData = $.csv.toArrays(csv, {
131131
onParseValue: $.csv.hooks.castToScalar
132132
});

examples/node-usage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
/* eslint-disable no-unused-vars */
12
var fs = require('fs');
23
var csv = require('jquery-csv');
3-
44
var sample = './data/sample.csv';
5+
56
fs.readFile(sample, 'UTF-8', function (err, csv) {
67
if (err) { console.log(err); }
78
csv.toArrays(csv, {}, function (err, data) {

src/jquery.csv.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828

2929
RegExp.escape = function (s) {
30-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
30+
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
3131
};
3232

3333
(function () {
@@ -944,7 +944,10 @@ RegExp.escape = function (s) {
944944
props = propsManual;
945945
}
946946

947-
var o, p, line, output = [], propName;
947+
var o;
948+
var line;
949+
var output = [];
950+
var propName;
948951
if (config.headers) {
949952
output.push(props);
950953
}

test/csv.from_array.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1+
/* eslint-disable no-unused-vars */
12
const test = require('tape');
23
const csv = require('../src/jquery.csv.js');
34
const fixtures = require('./fixtures/fixtures.js');
45

5-
const setup = () => {
6-
const fixtures = require('./fixtures/fixtures.js');
7-
return fixtures;
8-
};
9-
10-
const teardown = (fixtures) => {
11-
fixtures = {};
12-
};
13-
146
test('$.csv.fromArray()', (t) => { t.end(); });
157

8+
// TODO: Implement csv.fromArray()
169
// test('should be able to format a multi-cell entry', (t) => {
1710
// let result = csv.fromArray(fixtures.array_obj);
1811
// let expect = fixtures.array_csv;

test/csv.from_arrays.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ const test = require('tape');
22
const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

5-
const setup = () => {
6-
const fixtures = require('./fixtures/fixtures.js');
7-
return fixtures;
8-
};
9-
10-
const teardown = (fixtures) => {
11-
fixtures = {};
12-
};
13-
145
test('$.csv.fromArrays() - should be able to format multi-entry/multi-cell data set', (t) => {
156
let result = csv.fromArrays(fixtures.arrays1_obj);
167
let expect = fixtures.arrays1_csv;

test/csv.parsers.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ const test = require('tape');
22
const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

5-
const setup = () => {
6-
const fixtures = require('./fixtures/fixtures.js');
7-
return fixtures;
8-
};
9-
10-
const teardown = (fixtures) => {
11-
fixtures = {};
12-
};
13-
145
test('$.csv.parsers.splitLines() - should correctly split lines with default options', (t) => {
156
let result = csv.parsers.splitLines(fixtures.defaults_fivelines_csv);
167
t.equal(typeof (result), 'object', 'the returned object should be an array');

test/csv.to_array.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ const test = require('tape');
22
const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

5-
const setup = () => {
6-
const fixtures = require('./fixtures/fixtures.js');
7-
return fixtures;
8-
};
9-
10-
const teardown = (fixtures) => {
11-
fixtures = {};
12-
};
13-
145
test('$.csv.toArray() - should be able to parse an entry containing multiple cells', (t) => {
156
let result = csv.toArray(fixtures.array_csv);
167
let expect = fixtures.array_obj;

test/csv.to_arrays.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ const test = require('tape');
22
const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

5-
const setup = () => {
6-
const fixtures = require('./fixtures/fixtures.js');
7-
return fixtures;
8-
};
9-
10-
const teardown = (fixtures) => {
11-
fixtures = {};
12-
};
13-
145
test('$.csv.toArrays() - should be able to parse multi-entry/multi-cell input', (t) => {
156
let result = csv.toArrays(fixtures.arrays1_csv);
167
let expect = fixtures.arrays1_obj;

0 commit comments

Comments
 (0)