Reference · Tiles, layouts and deals
readTilesfunction
A LIST OF TILES AS TEXT, read the forgiving way: each word is a tile's name (east, red-dragon, 3p) or a
run of one-letter codes (abcF), and hand notation (123m456p) is read as it is written. Words that are no
tile are dropped, and so is ., the empty slot. A bare word that is a name wins over its letters, so east is the
east wind and not four tiles.
Import it
import { readTiles } from "@johnmorrisdotca/jarajara";
Definition
function readTiles(text: string | null | undefined): string[]
Parameters
| Name | Type | Description |
|---|---|---|
text | string | null | undefined | The unknown text or encoded record to interpret. |
Returns
string[]
A LIST OF TILES AS TEXT, read the forgiving way: each word is a tile's name (east, red-dragon, 3p) or a run of one-letter codes (abcF), and hand notation (123m456p) is read as it is written. Words that are no tile are dropped, and so is ., the empty slot. A bare word that is a name wins over its letters, so east is the east wind and not four tiles.
Examples
import { readTiles } from "@johnmorrisdotca/jarajara";
console.log(readTiles("123m456p"));[ 'a', 'b', 'c', 'm', 'n', 'o' ]What it prints (run when this page was built)