Reference · Framing, geometry and quiz tools
placesFromTextfunction
The regions a paste names. Order is the paste's, because somebody who wrote them in lesson order meant that order. A name written twice adds the place once.
Import it
import { placesFromText } from "@johnmorrisdotca/chizu";
Definition
function placesFromText(text: string, regions: readonly Named[], options?: MatchOptions): PastedPlaces
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Pasted names or serialized attribute text specified by this signature. |
regions | readonly Named[] | The native regions available for matching or layout. |
options (optional) | MatchOptions | The optional native drawing, matching, layout or quiz settings described by this signature. |
Returns
PastedPlaces
The regions a paste names. Order is the paste's, because somebody who wrote them in lesson order meant that order. A name written twice adds the place once.
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { placesFromText } from "@johnmorrisdotca/chizu";
console.log(placesFromText("Japan, フランス\nBrazil, Narnia", WORLD.regions));
// { codes: [ 'JP', 'FR', 'BR' ], missing: [ 'Narnia' ] }{ codes: [ 'JP', 'FR', 'BR' ], missing: [ 'Narnia' ] }What it prints (run when this page was built)