本文へ移動

Kotoba言葉

必要な単語一覧だけを読み込み、重複する文字を正しく判定し、日替わりやシード付きの単語ゲームを遊べます。

「Kotoba」は「言葉」です。 名前について(英語)

目次

リファレンス · 判定・得点・ゲームのルール

dailyWord関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The word of a day: the same for everybody who asks about the same day of the same list. Give a YYYY-MM-DD day, or a Date (read as a day in UTC, or in zone). Throws a RangeError for an empty list or a day that is not one.

インポート

import { dailyWord } from "@johnmorrisdotca/kotoba";

定義

function dailyWord(words: readonly string[], day?: DayKey | Date | number, options?: DailyOptions): string

引数

名前型説明
wordsreadonly string[]

The ordered nonempty word pool or accepted-guess dictionary specified by the signature.

day (省略可)string | number | Date

A valid YYYY-MM-DD date or moment specified by the signature.

options (省略可)DailyOptions

Native game, mount or daily choices specified by the signature.

戻り値

string

The word of a day: the same for everybody who asks about the same day of the same list. Give a YYYY-MM-DD day, or a Date (read as a day in UTC, or in zone). Throws a RangeError for an empty list or a day that is not one.

例

import { dailyWord } from "@johnmorrisdotca/kotoba";

console.log(dailyWord(["apple","berry","lemon"],"2026-10-12",{salt:"sample"}));
apple

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kotoba 1.2.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。