Allow TS to import countShips internally

This commit is contained in:
Oliver Akins 2022-06-19 12:41:37 -06:00
parent 762e2bdb1b
commit 1167c10707
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -1,4 +1,5 @@
/**
* @internal
* A helper method for counting how many ships are on each side of a specific
* ship on the board.
*
@ -8,7 +9,7 @@
* @returns An object containing the number of ships that are on each side of
* the target ship
*/
function countShips(board: any[], shipLocation: number) {
export function countShips(board: any[], shipLocation: number) {
return {
left: board.slice(1, shipLocation - 1).filter(x => x != null).length,
right: board.slice(shipLocation + 1).filter(x => x != null).length,