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

module.exports = function(args) {
  var parsedArgs = np.parse(args).
    require('name', 'string').
    require('piece', 'object').
    require('board', 'object').
    require('destination', 'object').
    values();

  var name = parsedArgs.name;
  var piece = parsedArgs.piece;
  var board = parsedArgs.board;
  var destination = parsedArgs.destination;
  var attacked = !!attackedPiece;

  return {
    name: function() { return name; },
    destination: function() { return destination; },
    perform: perform
  };

  function perform() {
    board.move({
      from: board.pieceLocation({ piece: piece }),
      to: destination
    });

    piece.moveCount++;
  }
};
<commit_msg>Store piece start location in Move constructor<commit_after>var _ = require('lodash');
var np = require('named-parameters');

module.exports = function(args) {
  var parsedArgs = np.parse(args).
    require('name', 'string').
    require('piece', 'object').
    require('board', 'object').
    require('destination', 'object').
    values();

  var name = parsedArgs.name;
  var piece = parsedArgs.piece;
  var board = parsedArgs.board;
  var originalLocation = board.pieceLocation({ piece: piece });
  var destination = parsedArgs.destination;
  var attacked = !!attackedPiece;

  return {
    name: function() { return name; },
    destination: function() { return destination; },
    perform: perform
  };

  function perform() {
    board.move({
      from: originalLocation,
      to: destination
    });

    piece.moveCount++;
  }
};

{'fraction_non_alphanumeric': 0.1506849315068493, 'fraction_numerical': 0.0, 'mean_word_length': 3.4763231197771587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4170362', 'n_tokens_mistral': 466, 'n_tokens_neox': 456, 'n_words': 119}