lib/sf.js
function _getRuleAsString(responders, callback){

  var respondersArr = [];

  var respondersLen = responders.length;
  var srcLen;
  var fileStr;

  responders.forEach(function(entry, i){
    respondersArr.push(TAP + '{');
    respondersArr.push(TAP + TAP + 'pattern: \'' + entry.pattern + '\',' + entry.comment);
    respondersArr.push(TAP + TAP + 'responder: {');
    respondersArr.push(TAP + TAP + TAP + 'dir: ' + '\'' + entry.responder.dir + '\',');
    respondersArr.push(TAP + TAP + TAP + 'src: [');

    srcLen = entry.responder.src.length;

    entry.responder.src.forEach(function(file, j){
      fileStr = TAP + TAP + TAP + TAP + '\'' + file + '\'';
      if(j < srcLen - 1){
        fileStr += ',';
      }
      respondersArr.push(fileStr);
    });

    respondersArr.push(TAP + TAP + TAP + ']');
    respondersArr.push(TAP + TAP + '}');

    if( i < respondersLen - 1){
      respondersArr.push(TAP + '},');
    }else{
      respondersArr.push(TAP + '}');
    }

  });

  if(typeof callback === 'function'){
    callback(null, respondersArr.join(EOL));
  }
}
function _getRuleAsString(responders, callback){

  var respondersArr = [];

  var respondersLen = responders.length;
  var srcLen;
  var fileStr;

  responders.forEach(function(entry, i){
    respondersArr.push(TAP + '{');
    respondersArr.push(TAP + TAP + 'pattern: \'' + entry.pattern + '\',' + entry.comment);
    respondersArr.push(TAP + TAP + 'responder: {');
    respondersArr.push(TAP + TAP + TAP + 'dir: ' + '\'' + entry.responder.dir + '\',');
    respondersArr.push(TAP + TAP + TAP + 'src: [');

    srcLen = entry.responder.src.length;

    entry.responder.src.forEach(function(file, j){
      fileStr = TAP + TAP + TAP + TAP + '\'' + file + '\'';
      if(j < srcLen - 1){
        fileStr += ',';
      }
      respondersArr.push(fileStr);
    });

    respondersArr.push(TAP + TAP + TAP + ']');
    respondersArr.push(TAP + TAP + '}');

    if( i < respondersLen - 1){
      respondersArr.push(TAP + '},');
    }else{
      respondersArr.push(TAP + '}');
    }

  });

  if(typeof callback === 'function'){
    callback(null, respondersArr.join(EOL));
  }
}
function _getRuleAsString ( responders , callback ) { var respondersArr = [ ] ; var respondersLen = responders . length ; var srcLen ; var fileStr ; responders . forEach ( function ( entry , i ) { respondersArr . push ( TAP + '{' ) ; respondersArr . push ( TAP + TAP + 'pattern: \'' + entry . pattern + '\',' + entry . comment ) ; respondersArr . push ( TAP + TAP + 'responder: {' ) ; respondersArr . push ( TAP + TAP + TAP + 'dir: ' + '\'' + entry . responder . dir + '\',' ) ; respondersArr . push ( TAP + TAP + TAP + 'src: [' ) ; srcLen = entry . responder . src . length ; entry . responder . src . forEach ( function ( file , j ) { fileStr = TAP + TAP + TAP + TAP + '\'' + file + '\'' ; if ( j < srcLen - 1 ) { fileStr += ',' ; } respondersArr . push ( fileStr ) ; } ) ; respondersArr . push ( TAP + TAP + TAP + ']' ) ; respondersArr . push ( TAP + TAP + '}' ) ; if ( i < respondersLen - 1 ) { respondersArr . push ( TAP + '},' ) ; } else { respondersArr . push ( TAP + '}' ) ; } } ) ; if ( typeof callback === 'function' ) { callback ( null , respondersArr . join ( EOL ) ) ; } }
Get the transferd rules as a string

@param {Object} responders the object of responder
@param {Function} callback
Get the transferd rules as a string