Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Games and state

fillInfunction

Put values into a string's braces: fillIn("Bid {n}", { n: 3 }) is "Bid 3". A brace with no value is left as it is.

Import it

import { fillIn } from "@johnmorrisdotca/toranpu";

Definition

function fillIn(template: string, values: Record<string, string | number>): string

Parameters

NameTypeDescription
templatestring

The text with named braces to fill.

valuesRecord<string, string | number>

Replacement values keyed by the braces in the template.

Returns

string

Put values into a string's braces: fillIn("Bid {n}", { n: 3 }) is "Bid 3". A brace with no value is left as it is.

Examples

import { fillIn } from "@johnmorrisdotca/toranpu";

console.log(fillIn("Seat {seat}: {name}", { seat: 1, name: "Aki" }));
Seat 1: Aki

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.