fromJSON関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The solves in a JSON export, or null where the text is not one: not JSON,
not this format, or a later one. Each solve is put together again from its
size and its notation; one whose notation the cube cannot turn is left out,
and what the file says of state, solved and count is ignored.
インポート
import { fromJSON } from "@johnmorrisdotca/kyuubu";
定義
function fromJSON(text: string): SolveRecord[] | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | The text to parse or format. |
戻り値
SolveRecord[] | null
The solves in a JSON export, or null where the text is not one: not JSON, not this format, or a later one. Each solve is put together again from its size and its notation; one whose notation the cube cannot turn is left out, and what the file says of state, solved and count is ignored.
例
import { fromJSON, parseMoves, toJSON } from "@johnmorrisdotca/kyuubu";
const moves = parseMoves("R U2", 3)!;
const record = { size: 3, scramble: parseMoves("R", 3)!, moves: parseMoves("R'", 3)!, ms: 1000, seed: "docs" };
console.log(fromJSON(toJSON(record))?.length);1出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。