lib/workflow-in-memory-backend.js
function nextJob(index, callback) {
            if (typeof (index) === 'function') {
                callback = index;
                index = 0;
            }

            if (queued_jobs.length === 0) {
                return callback(null, null);
            }

            var slice = queued_jobs.slice(index, index + 1);

            if (slice.length === 0) {
                return callback(null, null);
            } else {
                return getJob(slice[0], callback);
            }
        }
function nextJob(index, callback) {
            if (typeof (index) === 'function') {
                callback = index;
                index = 0;
            }

            if (queued_jobs.length === 0) {
                return callback(null, null);
            }

            var slice = queued_jobs.slice(index, index + 1);

            if (slice.length === 0) {
                return callback(null, null);
            } else {
                return getJob(slice[0], callback);
            }
        }
Get the next queued job. index - Integer, optional. When given, it'll get the job at index position (when not given, it'll return the job at position zero). callback - f(err, job)