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

Reference · Marking, scores and game rules

markKanaGuessfunction

A guess coloured against the word, place by place. Both are arrays of single kana.

Import it

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

Definition

function markKanaGuess(guess: readonly string[], word: readonly string[]): KanaMarked[]

Parameters

NameTypeDescription
guessreadonly string[]

The guessed word or kana array, with the same length as the hidden word.

wordreadonly string[]

The word or kana array specified by this signature.

Returns

KanaMarked[]

A guess coloured against the word, place by place. Both are arrays of single kana.

Examples

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

console.log(markKanaGuess(["ぱ","な"],["は","な"]));
[
  { mark: 'hit', wrongSize: false, wrongMark: true },
  { mark: 'hit', wrongSize: false, wrongMark: false }
]

What it prints (run when this page was built)

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