lib/run/options.js
function (location, options, callback) {
            if (_.isArray(location)) { return callback(null, location); }

            util.fetch(location, function (err, data) {
                if (err) {
                    return callback(err);
                }

                // Try loading as a JSON, fall-back to CSV. @todo: switch to file extension based loading.
                async.waterfall([
                    (cb) => {
                        try {
                            return cb(null, liquidJSON.parse(data.trim()));
                        }
                        catch (e) {
                            return cb(null, undefined); // e masked to avoid displaying JSON parse errors for CSV files
                        }
                    },
                    (json, cb) => {
                        if (json) {
                            return cb(null, json);
                        }
                        // Wasn't JSON
                        parseCsv(data, {
                            columns: true,
                            escape: '\\',
                            cast: csvAutoParse,
                            trim: true
                        }, cb);
                    }
                ], (err, parsed) => {
                    if (err) {
                        // todo: Log meaningful stuff here
                        return callback(err);
                    }

                    callback(null, parsed);
                });
            });
        }
function (location, options, callback) {
            if (_.isArray(location)) { return callback(null, location); }

            util.fetch(location, function (err, data) {
                if (err) {
                    return callback(err);
                }

                // Try loading as a JSON, fall-back to CSV. @todo: switch to file extension based loading.
                async.waterfall([
                    (cb) => {
                        try {
                            return cb(null, liquidJSON.parse(data.trim()));
                        }
                        catch (e) {
                            return cb(null, undefined); // e masked to avoid displaying JSON parse errors for CSV files
                        }
                    },
                    (json, cb) => {
                        if (json) {
                            return cb(null, json);
                        }
                        // Wasn't JSON
                        parseCsv(data, {
                            columns: true,
                            escape: '\\',
                            cast: csvAutoParse,
                            trim: true
                        }, cb);
                    }
                ], (err, parsed) => {
                    if (err) {
                        // todo: Log meaningful stuff here
                        return callback(err);
                    }

                    callback(null, parsed);
                });
            });
        }
function ( location , options , callback ) { if ( _ . isArray ( location ) ) { return callback ( null , location ) ; } util . fetch ( location , function ( err , data ) { if ( err ) { return callback ( err ) ; } // Try loading as a JSON, fall-back to CSV. @todo: switch to file extension based loading. async . waterfall ( [ ( cb ) => { try { return cb ( null , liquidJSON . parse ( data . trim ( ) ) ) ; } catch ( e ) { return cb ( null , undefined ) ; // e masked to avoid displaying JSON parse errors for CSV files } } , ( json , cb ) => { if ( json ) { return cb ( null , json ) ; } // Wasn't JSON parseCsv ( data , { columns : true , escape : '\\' , cast : csvAutoParse , trim : true } , cb ) ; } ] , ( err , parsed ) => { if ( err ) { // todo: Log meaningful stuff here return callback ( err ) ; } callback ( null , parsed ) ; } ) ; } ) ; }
The iterationData loader module, with support for JSON or CSV data files.

@param {String|Object[]} location - The path to the iteration data file for the current collection run, or
the array of iteration data objects.
@param {Object} options - The set of wrapped options.
@param {Function} callback - The function invoked to indicate the end of the iteration data loading routine.
@returns {*}
The iterationData loader module with support for JSON or CSV data files .