CSV to array

Introduction

Generate array from csv string.

Usage

Sample code

Import class

import rexCSVToArray from './plugins/csvtoarray.js';

Install global plugin

Install plugin in configuration of game

import CSVToArrayPlugin from './plugins/csvtoarray-plugin.js';

var config = {
    // ...
    plugins: {
        global: [{
            key: 'rexCSVToArray',
            plugin: CSVToArrayPlugin,
            start: true
        }
        // ...
        ]
    }
    // ...
};
var game = new Phaser.Game(config);

Convert csv

var arr = scene.plugins.get('rexCSVToArray').convert(csvString, {
    // delimiter: ',',
    // convert: true
});

Values will be converted to number, boolean, null, or string, if convert is true.