string-prototype-format-js

1.0.0 • Public • Published

string-prototype-format-js

Latest Version Licence GitHub Tests Action Status Downloads

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.

Package Sidebar

Install

npm i string-prototype-format-js

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.93 kB

Total Files

4

Last publish

Collaborators

  • jornatf