Skip to main content
Home

Built and signed on GitHub Actions

便利なテンプレート文字列ビルダー

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
10 months ago (1.0.1)

About

効率よくテンプレート文字列を生成するためのライブラリ

Examples

Example 1

const hello = Template.new`Hello ${Template.str("Template")}!`;

const profile = Template.new`\
Name: ${Template.str()}
Age: ${Template.num()}
Gender: ${Template.tuple(["男性","女性","その他","無回答"])}
Role: ${Template.record({
   admin:"管理者",
    stuff:"スタッフ",
    moderator:"モデレーター",
    member:"メンバー"
})}
Rank: ${Template.cond("プレミアム","一般")}ユーザー
Log:
${Template.lines()}
`;
profile.compile("Alice",18,1,"admin",true,[]);
const compile = profile.prepare("name","age","gender","role","isPremium","logs");

compile({
  name:"Alice",
  age:18,
  gender:1,
  role:"admin",
  isPremium:true,
  logs:[]
})
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@pnsk/template

Import symbol

import * as template from "@pnsk/template";
or

Import directly with a jsr specifier

import * as template from "jsr:@pnsk/template";

Add Package

pnpm i jsr:@pnsk/template
or (using pnpm 10.8 or older)
pnpm dlx jsr add @pnsk/template

Import symbol

import * as template from "@pnsk/template";

Add Package

yarn add jsr:@pnsk/template
or (using Yarn 4.8 or older)
yarn dlx jsr add @pnsk/template

Import symbol

import * as template from "@pnsk/template";

Add Package

npx jsr add @pnsk/template

Import symbol

import * as template from "@pnsk/template";

Add Package

bunx jsr add @pnsk/template

Import symbol

import * as template from "@pnsk/template";