Skip to content

moveTop

moveTop<T>(from, to, count?): T[]

Defined in: src/modules/pile/pile-array.ts:10

Move the top count items of from onto to, keeping their order — a draw, or a run of cards moved as one. Moves fewer when from holds fewer; count is truncated and clamped at 0. Both arrays change in place (index 0 is the bottom). Returns the moved items, bottom first.

With from === to the items are taken off and put back on, so the array is unchanged.

T

T[]

T[]

number = 1

T[]