FmtInstallation
Installation
How to install and import @visulima/fmt
Last updated:
Installation
Install the package using your preferred package manager:
bash npm install @visulima/fmt bash pnpm add @visulima/fmt bash yarn add @visulima/fmt bash bun add @visulima/fmt Import Methods
ESM (Recommended)
Import the functions you need:
import { format, build } from "@visulima/fmt";
const result = format("Hello %s", ["World"]);CommonJS
For CommonJS environments:
const { format, build } = require("@visulima/fmt");
const result = format("Hello %s", ["World"]);Requirements
- Node.js: ≥22.13 ≤25.x
- TypeScript: ≥5.0 (optional, for type definitions)
Verify Installation
Test the installation with a simple format:
import { format } from "@visulima/fmt";
const result = format("Testing %d + %d = %d", [2, 2, 4]);
console.log(result); // "Testing 2 + 2 = 4"If you see the expected output, installation was successful!
TypeScript Support
The package includes full TypeScript type definitions:
import { format, build } from "@visulima/fmt";
import type { FormatOptions, Formatters } from "@visulima/fmt";
const options: FormatOptions = {
stringify: JSON.stringify,
};
const result: string = format("Value: %j", [{ key: "value" }], options);