How to use the papaparse/papaparse.min.js.parse function in papaparse

To help you get started, we’ve selected a few papaparse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rexrainbow / phaser3-rex-notes / plugins / data / csvtohashtable / CsvToHashTable.js View on Github external
loadCSV(csvString, config) {
        var delimiter = GetValue(config, 'delimiter', ',');
        var convert = GetValue(config, 'convert', true);
        var convertScope = GetValue(config, 'convertScope', undefined);
        if (!convert) {
            convert = undefined;
            convertScope = undefined;
        } else if (convert === true) {
            convert = TypeConvert;
            convertScope = undefined;
        }

        this.clear();
        var arr = CSVParser.parse(csvString, {
            delimiter: delimiter
        }).data;

        this.colKeys = ArrayCopy(this.colKeys, arr[0]);
        this.rowKeys.length = arr.length - 1;
        for (var i = 0, len = this.rowKeys.length; i < len; i++) {
            this.rowKeys[i] = arr[i + 1][0]; // skip 1st row
        }

        var colKeys = this.colKeys,
            rowKeys = this.rowKeys;
        var table = this.table;
        var colKey, rowKey, row, value;

        for (var r = 0, rlen = rowKeys.length; r < rlen; r++) {
            rowKey = rowKeys[r];
github rexrainbow / phaser3-rex-notes / plugins / logic / achievements / Achievements.js View on Github external
loadCSV(csvString, config) {
        Clear(this.achievements);
        var delimiter = GetValue(config, 'delimiter', ',');
        var table = CSVParser.parse(csvString, {
            delimiter: delimiter
        }).data;
        var keys = table[0];
        keys.splice(0, 2);
        var items, achievement, levelName;
        for (var i = 1, cnt = table.length; i < cnt; i++) {
            items = table[i];
            levelName = items[0];
            achievement = new Achievement(keys, items);

            if (!this.achievements.hasOwnProperty(levelName)) {
                this.achievements[levelName] = [];
            }
            this.achievements[levelName].push(achievement);
        }
        return this;
github rexrainbow / phaser3-rex-notes / plugins / data / csvtoarray / CSVToArray.js View on Github external
var CSVToArray = function (csvString, config) {
    var delimiter = GetValue(config, 'delimiter', ',');
    var convert = GetValue(config, 'convert', true);

    var arr = CSVParser.parse(csvString, {
        delimiter: delimiter,
        dynamicTyping: convert
    }).data;
    return arr;
};
github rexrainbow / phaser3-rex-notes / plugins / logic / runcommands / csvscenario / CSVScenario.js View on Github external
append(csvString, delimiter) {
        if (delimiter === undefined) {
            delimiter = ',';
        }
        var arr = CSVParser.parse(csvString, {
            delimiter: delimiter
        }).data;
        this.parse(arr);
        return this;
    }
github rexrainbow / phaser3-rex-notes / plugins / logic / conditionstable / ConditionsTable.js View on Github external
loadCSV(csvString, config) {
        Clear(this.tests);
        var delimiter = GetValue(config, 'delimiter', ',');
        var table = CSVParser.parse(csvString, {
            delimiter: delimiter
        }).data;
        var keys = table[0];
        keys.shift();
        var items, testName;
        for (var i = 1, cnt = table.length; i < cnt; i++) {
            items = table[i];
            testName = items.shift();
            this.tests.push({
                name: testName,
                function: CreateTestFunction(keys, items)
            });
        }
        return this;
    }
github rexrainbow / phaser3-rex-notes / plugins / logic / quest / questions / ParseCSV.js View on Github external
var ParseCSV = function (csvString, config) {
    var delimiter = GetValue(config, 'delimiter', ',');
    var arr = CSVParser.parse(csvString, {
        header: true,
        delimiter: delimiter,
    }).data;

    var questionType = GetValue(config, 'types.question', 'q');
    var optionType = GetValue(config, 'types.option', '');
    var convertFn = GetValue(config, 'convert', true);
    if (convertFn === true) {
        convertFn = DefaultConvertFn;
    }

    var items = [];
    var rowObj, rowType,
        item, option;
    for (var i = 0, cnt = arr.length; i < cnt; i++) {
        rowObj = arr[i];

papaparse

Fast and powerful CSV parser for the browser that supports web workers and streaming large files. Converts CSV to JSON and JSON to CSV.

MIT
Latest version published 1 year ago

Package Health Score

86 / 100
Full package analysis