CardGameCodec型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A game's keeping: encode writes it as text, decode reads it back or gives null.
インポート
import type { CardGameCodec } from "@johnmorrisdotca/toranpu";
定義
type CardGameCodec<S> = {
encode: (game: S) => string;
decode: (text: string | null) => S | null;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
encode | (game: S) => string | |
decode | (text: string | null) => S | null |
例
import type { CardGameCodec, GameOf } from "@johnmorrisdotca/toranpu";
import { rulesFor } from "@johnmorrisdotca/toranpu";
const value: CardGameCodec<GameOf<"hearts">> = rulesFor("hearts");
console.log(typeof value.decode);function出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。