serialOrdered.js
function serialOrdered(list, iterator, sortMethod, callback)
{
  var state = initState(list, sortMethod);

  iterate(list, iterator, state, function iteratorHandler(error, result)
  {
    if (error)
    {
      callback(error, result);
      return;
    }

    state.index++;

    // are we there yet?
    if (state.index < (state['keyedList'] || list).length)
    {
      iterate(list, iterator, state, iteratorHandler);
      return;
    }

    // done here
    callback(null, state.results);
  });

  return terminator.bind(state, callback);
}
function serialOrdered(list, iterator, sortMethod, callback)
{
  var state = initState(list, sortMethod);

  iterate(list, iterator, state, function iteratorHandler(error, result)
  {
    if (error)
    {
      callback(error, result);
      return;
    }

    state.index++;

    // are we there yet?
    if (state.index < (state['keyedList'] || list).length)
    {
      iterate(list, iterator, state, iteratorHandler);
      return;
    }

    // done here
    callback(null, state.results);
  });

  return terminator.bind(state, callback);
}
function serialOrdered ( list , iterator , sortMethod , callback ) { var state = initState ( list , sortMethod ) ; iterate ( list , iterator , state , function iteratorHandler ( error , result ) { if ( error ) { callback ( error , result ) ; return ; } state . index ++ ; // are we there yet? if ( state . index < ( state [ 'keyedList' ] || list ) . length ) { iterate ( list , iterator , state , iteratorHandler ) ; return ; } // done here callback ( null , state . results ) ; } ) ; return terminator . bind ( state , callback ) ; }
Runs iterator over provided sorted array elements in series

@param   {array|object} list - array or object (named list) to iterate over
@param   {function} iterator - iterator to run
@param   {function} sortMethod - custom sort function
@param   {function} callback - invoked when all elements processed
@returns {function} - jobs terminator
Runs iterator over provided sorted array elements in series