Skip to the content

Kotoba言葉

Load only the word lists you need, mark repeated letters correctly and play a daily or seeded word game.

Kotoba is the Japanese word for words. About the name

Contents

How-to

Choose a stable daily word

Pin the ordered word pool and define the calendar boundary.

Supply a day explicitly

import {dailyWord,dayKey,isDayKey} from "@johnmorrisdotca/kotoba";
const words = ["apple","berry","lemon"];
const day = dayKey(new Date("2026-10-12T12:00:00Z"),"UTC");
console.log(isDayKey(day),dailyWord(words,day,{salt:"five-letter"}));
true lemon

A cycle deals each pool position once before repeating. The choice depends on the day, salt, pool length and order; a changed dictionary can change the daily answer. Pin the package/list version or keep your own ordered pool when comparisons must remain stable. Repeated values in a supplied pool remain repeated positions.

Use the same boundary everywhere

UTC is the default; dayKey and DailyOptions.zone can name an IANA time zone for host-local midnight. Invalid moments, dates, zones or nonpositive counts throw. Pass a valid nonempty pool. The element's daily attribute uses validated UTC dates, resolves today at mount time and has no rollover timer. A host-selected hidden word takes precedence, then daily, then seed. See the embed contract.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kotoba 1.2.0.