Le0X8/string-params

★ 0Forks 0TypeScriptGitHub ↗Compare

README

string-params

A library for formatting strings with parameters, aiming to be just like Rust's powerful format! macro.

import sp from 'string-params';

const word = 'world';

// all of these will print "Hello, world!"
console.log(sp('Hello, {}!', word));
console.log(sp('Hello, {0}!', word));
console.log(sp('Hello, {word}!', { word }));

As almost 100% of the API is the same as the macro's, you can directly refer to the Rust docs for more information.

Contributors

Le0X8

Issues