index.js
function formatObject(val) {
  if (val.options && val.options.format === false) {
    return val;
  }

  var res = { options: val.options };
  res.files = val.files;
  for (var key in val) {
    if (key === 'files' || key === 'options') {
      continue;
    }
    res[key] = val[key];
  }

  var len = res.files.length;
  var idx = -1;

  while (++idx < len) {
    var ele = res.files[idx];
    var obj = {};

    obj.options = {};
    obj.src = ele.src || [];
    obj.dest = ele.dest || '';

    copyNonfiles(obj, ele);
    if (!ele.options) {
      obj.options = res.options;
    }

    res.files[idx] = obj;
  }
  return res;
}
function formatObject(val) {
  if (val.options && val.options.format === false) {
    return val;
  }

  var res = { options: val.options };
  res.files = val.files;
  for (var key in val) {
    if (key === 'files' || key === 'options') {
      continue;
    }
    res[key] = val[key];
  }

  var len = res.files.length;
  var idx = -1;

  while (++idx < len) {
    var ele = res.files[idx];
    var obj = {};

    obj.options = {};
    obj.src = ele.src || [];
    obj.dest = ele.dest || '';

    copyNonfiles(obj, ele);
    if (!ele.options) {
      obj.options = res.options;
    }

    res.files[idx] = obj;
  }
  return res;
}
function formatObject ( val ) { if ( val . options && val . options . format === false ) { return val ; } var res = { options : val . options } ; res . files = val . files ; for ( var key in val ) { if ( key === 'files' || key === 'options' ) { continue ; } res [ key ] = val [ key ] ; } var len = res . files . length ; var idx = - 1 ; while ( ++ idx < len ) { var ele = res . files [ idx ] ; var obj = { } ; obj . options = { } ; obj . src = ele . src || [ ] ; obj . dest = ele . dest || '' ; copyNonfiles ( obj , ele ) ; if ( ! ele . options ) { obj . options = res . options ; } res . files [ idx ] = obj ; } return res ; }
Optionally sort the keys in all of the files objects.
Helps with debugging.

@param {Object} `val` Pass `{sort: true}` on `val.options` to enable sorting.
@return {Object}
Optionally sort the keys in all of the files objects . Helps with debugging .