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
| Name | Type | Description |
|---|---|---|
idioms | readonly Idiom[] | The phrases to search, from |
text | string | 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);8What it prints (run when this page was built)