export const pawnsAt = (pawns, position) => {
  return Array.isArray(pawns) ? pawns.filter(p => p && p.position === position) : [];
};

export const countPawnsAt = (pawns, position) => pawnsAt(pawns, position).length;

export const opponentsAt = (pawns, position, myColor) =>
  pawnsAt(pawns, position).filter(p => p.color !== myColor);

export default { pawnsAt, countPawnsAt, opponentsAt };
