Reference · Tiles, layouts and deals
countTilesfunction
How many of each face a list of tiles holds, by code; faces it holds none of are left out.
Import it
import { countTiles } from "@johnmorrisdotca/jarajara";
Definition
function countTiles(codes: Iterable<string>): Map<string, number>
Parameters
| Name | Type | Description |
|---|---|---|
codes | Iterable<string> | The tile face codes in current order. |
Returns
Map<string, number>
How many of each face a list of tiles holds, by code; faces it holds none of are left out.
Examples
import { countTiles } from "@johnmorrisdotca/jarajara";
console.log([...countTiles(["a","a","b"])]);[ [ 'a', 2 ], [ 'b', 1 ] ]What it prints (run when this page was built)