var _ = require('lodash');
var np = require('named-parameters');

module.exports = function() {
  return function(args) {
    var parsedArgs = np.parse(args).
      require('piece').
      require('board').
      values();

    var board = parsedArgs.board;
    var piece = parsedArgs.piece;
    var currentLocation = board.location(piece);
    var attackedSquares = [];

    var row = currentLocation.row + 1;
    var col = currentLocation.col - 1;
    while(row < board.rowCount && col >= 0) {
      var location = { row: row, col: col };

      if (board.spaceUnoccupied({ location: location })){
        attackedSquares.push(location);
      } else if (board.couldTake({ piece: piece, location: location })){
        attackedSquares.push({ row: row, col: col });
        break;
      } else {
        break;
      }
      row++;
      col--;
    }

    return {
      moveSquares: [],
      attackedSquares: attackedSquares
    };
  };
};

@@ -735,38 +735,24 @@
 es.push(
-%7B row: row, col: col %7D
+location
 );%0A     

Use existing location variable