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

searchIdiomsfunction

The phrases that hold a piece of text in their written form, their reading or any of their meanings, ignoring case.

Import it

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

Definition

function searchIdioms(idioms: readonly Idiom[], text: string): Idiom[]

Parameters

NameTypeDescription
idiomsreadonly Idiom[]

The phrases to search, from readIdioms.

textstring

What was typed; blank text matches every phrase.

Returns

Idiom[]

The phrases that match, in the order given.

Examples

import { readIdioms, searchIdioms } from "@johnmorrisdotca/kotoba";
import { JA_IDIOMS } from "@johnmorrisdotca/kotoba/idioms-ja";

console.log(searchIdioms(readIdioms(JA_IDIOMS), "油").length);
8

What it prints (run when this page was built)

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