string-prototype-format-js
string-prototype-format-js is a NPM Package 'String.prototype' extension to format a string replacing variables.
Installation
# In your terminal, enter command:
npm install string-prototype-format-js
Usage
Example
require("string-prototype-format-js");
var str = "Hello I'm % and I'm % years old.";
var formatted = str.format(["John", 24]);
console.log(formatted);
// Output: "Hello I'm John and I'm 24 years old."
Function notice
"string...".format([...args]: string[], varType?: string): string
Params | Type | Description |
---|---|---|
args |
String[] |
Value of each variable in the same order initiated in the String |
varType |
String |
Where to put each value (Default: $ ) |
Contributing
If you are interested in this project and want to improve it, fix errors or bugs, you're welcome to contribute.
Credits
Licence
The MIT License (MIT).
[!Note] Please see License File for more information.