smtfmt
v0.0.1-beta.2
Published
Utilities for formatting and printing Strings.
Downloads
3
Readme
smtfmt
Utilities for formatting and printing Strings.
smtfmt is ported from SmartFormat.NET.
Installing
Install smtfmt
using npm
:
npm install --save smtfmt
Or yarn
:
yarn add smtfmt
Examples
JavaScript:
const { fromat } = require('smtfmt');
format('Hello'); // -> Hello
format('Hello, {0}!', 'World'); // -> Hello, World!
format('The number is {0}', 1); // -> The number is 1
format('{0} {1}', 1, 2); // -> 1 2
TypeScript:
import { fromat } from 'smtfmt';
format('Hello'); // -> Hello
format('Hello, {0}!', 'World'); // -> Hello, World!
format('The number is {0}', 1); // -> The number is 1
format('{0} {1}', 1, 2); // -> 1 2