+
+
+
+
+
+
+
+
+ or
+
+
+
+
+
+
+
+
+
+
+ Open the Console in your browser's inspector tools to see results.
+
+
+
+
+
\ No newline at end of file
diff --git a/player/player.js b/player/player.js
new file mode 100644
index 0000000..9af6397
--- /dev/null
+++ b/player/player.js
@@ -0,0 +1,70 @@
+var stepped = 0;
+var start, end;
+
+$(function()
+{
+ $('#submit').click(function()
+ {
+ stepped = 0;
+ var txt = $('#input').val();
+ var files = $('#files')[0].files;
+ var config = buildConfig();
+
+ if (files.length > 0)
+ {
+ start = performance.now();
+
+ $('#files').parse({
+ config: config,
+ before: function(file, inputElem)
+ {
+ console.log("Parsing file:", file);
+ },
+ complete: function()
+ {
+ console.log("Done with all files.");
+ }
+ });
+ }
+ else
+ {
+ start = performance.now();
+ var results = Papa.parse(txt, config);
+ console.log("Synchronous parse results:", results);
+ }
+ });
+
+ $('#insert-tab').click(function()
+ {
+ $('#delimiter').val('\t');
+ });
+});
+
+
+
+function buildConfig()
+{
+ return {
+ delimiter: $('#delimiter').val(),
+ header: $('#header').prop('checked'),
+ dynamicTyping: $('#dynamicTyping').prop('checked'),
+ preview: parseInt($('#preview').val() || 0),
+ step: $('#stream').prop('checked') ? stepFn : undefined,
+ encoding: $('#encoding').val(),
+ worker: $('#worker').prop('checked'),
+ comments: $('#comments').val(),
+ complete: completeFn,
+ download: $('#download').prop('checked')
+ };
+}
+
+function stepFn(results, parser)
+{
+ stepped++;
+}
+
+function completeFn()
+{
+ end = performance.now();
+ console.log("Finished input. Time:", end-start, arguments);
+}
\ No newline at end of file
diff --git a/tests.html b/tests.html
deleted file mode 100644
index acf8998..0000000
--- a/tests.html
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
- '
+ + '+ | '
+ + '' + testDescription + ' | '
+ + passOrFailTd(results.data)
+ + passOrFailTd(results.errors)
+ + 'condensed ' + JSON.stringify(test.config, null, 2) + ' | '
+ + 'condensed ' + revealChars(test.input) + ' | '
+ + 'condensed data: ' + JSON.stringify(test.expected.data, null, 4) + '\r\nerrors: ' + JSON.stringify(test.expected.errors, null, 4) + ' | '
+ + 'condensed data: ' + JSON.stringify(actual.data, null, 4) + '\r\nerrors: ' + JSON.stringify(actual.errors, null, 4) + ' | '
+ + '
';
+
+ $('#results').append(tr);
+
+ if (!results.data.passed || !results.errors.passed)
+ $('#test-'+num+' td.rvl').click();
+
+ return results.data.passed && results.errors.passed
+}
+
+function compare(actualData, actualErrors, expected)
+{
+ var data = compareData(actualData, expected.data);
+ var errors = compareErrors(actualErrors, expected.errors);
+ return {
+ data: data,
+ errors: errors
+ }
+}
+
+function compareData(actual, expected)
+{
+ var passed = true;
+
+ if (actual.length != expected.length)
+ passed = false;
+
+ for (var row = 0; row < expected.length; row++)
+ {
+ if (actual.length != expected.length)
+ {
+ passed = false;
+ break;
+ }
+
+ for (var col = 0; col < expected[row].length; col++)
+ {
+ if (actual[row].length != expected[row].length)
+ {
+ passed = false;
+ break;
+ }
+
+ var expectedVal = expected[row][col];
+ var actualVal = actual[row][col];
+
+ if (actualVal !== expectedVal)
+ {
+ passed = false;
+ break;
+ }
+ }
+ }
+
+ // We pass back an object right now, even though it only contains
+ // one value, because we might add details to the test results later
+ // (same with compareErrors below)
+ return {
+ passed: passed
+ };
+}
+
+function compareErrors(actual, expected)
+{
+ var passed = JSON.stringify(actual) == JSON.stringify(expected);
+
+ return {
+ passed: passed
+ };
+}
+
+function passOrFailTd(result)
+{
+ if (result.passed)
+ return '