lib/run/options.js
function (value, options, callback) {
            /**
             * The post collection load handler.
             *
             * @param {?Error} err - An Error instance / null, passed from the collection loader.
             * @param {Object} collection - The collection / raw JSON object, passed from the collection loader.
             * @returns {*}
             */
            var done = function (err, collection) {
                if (err) {
                    return callback(err);
                }

                // ensure that the collection option is present before starting a run
                if (!_.isObject(collection)) {
                    return callback(new Error(COLLECTION_LOAD_ERROR_MESSAGE));
                }

                // ensure that the collection reference is an SDK instance
                // @todo - should this be handled by config loaders?
                collection = new Collection(Collection.isCollection(collection) ?
                    // if the option contain an instance of collection, we simply clone it for future use
                    // create a collection in case it is not one. user can send v2 JSON as a source and that will be
                    // converted to a collection
                    collection.toJSON() : collection);

                callback(null, collection);
            };

            // if the collection has been specified as an object, convert to V2 if necessary and return the result
            if (_.isObject(value)) {
                return processCollection(value, done);
            }

            externalLoader('collection', value, options, function (err, data) {
                if (err) {
                    return done(err);
                }
                if (!_.isObject(data)) {
                    return done(new Error(COLLECTION_LOAD_ERROR_MESSAGE));
                }

                return processCollection(data, done);
            });
        }
function (value, options, callback) {
            /**
             * The post collection load handler.
             *
             * @param {?Error} err - An Error instance / null, passed from the collection loader.
             * @param {Object} collection - The collection / raw JSON object, passed from the collection loader.
             * @returns {*}
             */
            var done = function (err, collection) {
                if (err) {
                    return callback(err);
                }

                // ensure that the collection option is present before starting a run
                if (!_.isObject(collection)) {
                    return callback(new Error(COLLECTION_LOAD_ERROR_MESSAGE));
                }

                // ensure that the collection reference is an SDK instance
                // @todo - should this be handled by config loaders?
                collection = new Collection(Collection.isCollection(collection) ?
                    // if the option contain an instance of collection, we simply clone it for future use
                    // create a collection in case it is not one. user can send v2 JSON as a source and that will be
                    // converted to a collection
                    collection.toJSON() : collection);

                callback(null, collection);
            };

            // if the collection has been specified as an object, convert to V2 if necessary and return the result
            if (_.isObject(value)) {
                return processCollection(value, done);
            }

            externalLoader('collection', value, options, function (err, data) {
                if (err) {
                    return done(err);
                }
                if (!_.isObject(data)) {
                    return done(new Error(COLLECTION_LOAD_ERROR_MESSAGE));
                }

                return processCollection(data, done);
            });
        }
function ( value , options , callback ) { /**
             * The post collection load handler.
             *
             * @param {?Error} err - An Error instance / null, passed from the collection loader.
             * @param {Object} collection - The collection / raw JSON object, passed from the collection loader.
             * @returns {*}
             */ var done = function ( err , collection ) { if ( err ) { return callback ( err ) ; } // ensure that the collection option is present before starting a run if ( ! _ . isObject ( collection ) ) { return callback ( new Error ( COLLECTION_LOAD_ERROR_MESSAGE ) ) ; } // ensure that the collection reference is an SDK instance // @todo - should this be handled by config loaders? collection = new Collection ( Collection . isCollection ( collection ) ? // if the option contain an instance of collection, we simply clone it for future use // create a collection in case it is not one. user can send v2 JSON as a source and that will be // converted to a collection collection . toJSON ( ) : collection ) ; callback ( null , collection ) ; } ; // if the collection has been specified as an object, convert to V2 if necessary and return the result if ( _ . isObject ( value ) ) { return processCollection ( value , done ) ; } externalLoader ( 'collection' , value , options , function ( err , data ) { if ( err ) { return done ( err ) ; } if ( ! _ . isObject ( data ) ) { return done ( new Error ( COLLECTION_LOAD_ERROR_MESSAGE ) ) ; } return processCollection ( data , done ) ; } ) ; }
The collection file load helper for the current run.

@param {Object|String} value - The collection, specified as a JSON object, or the path to it's file.
@param {Object} options - The set of wrapped options.
@param {Function} callback - The callback function invoked to mark the end of the collection load routine.
@returns {*}
The collection file load helper for the current run .