1.0.3 • Published 11 months ago

@jrbailey819/unique-string-interpolator v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

String Formatter

A simple and lightweight Node.js package for formatting strings with parameter interpolation.

Installation

npm install string-formatter

Usage

const StringFormatter = require('string-formatter');

const formatter = new StringFormatter();

const template = 'Hello, ${name}! You are ${age} years old.';
const params = { name: 'John', age: 30 };

const result = formatter.format(template, params);
console.log(result); // Output: Hello, John! You are 30 years old.

API

StringFormatter

The main class exported by this package.

format(template: string, params: object): string

Formats the given template string by replacing placeholders with corresponding values from the params object.

  • template: A string containing placeholders in the format ${key}.
  • params: An object containing key-value pairs for interpolation.

Returns the formatted string.

License

MIT

1.0.3

11 months ago

1.0.3-alpha.0

11 months ago

1.0.2

11 months ago

1.0.2-alpha.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago