https://github.com/arshadkazmi42/strmat
Node plugin for string formatting like python
https://github.com/arshadkazmi42/strmat
dynamic dynamic-string-values formatter nodejs python-string string values
Last synced: 2 months ago
JSON representation
Node plugin for string formatting like python
- Host: GitHub
- URL: https://github.com/arshadkazmi42/strmat
- Owner: arshadkazmi42
- License: mit
- Created: 2019-05-20T17:42:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T13:14:56.000Z (about 3 years ago)
- Last Synced: 2025-07-26T16:25:27.457Z (3 months ago)
- Topics: dynamic, dynamic-string-values, formatter, nodejs, python-string, string, values
- Language: JavaScript
- Size: 151 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# strmat
[](https://github.com/arshadkazmi42/strmat/actions/workflows/nodejs.yml)
[](https://www.npmjs.com/package/strmat)
[](https://www.npmjs.com/package/strmat)
[](https://github.com/arshadkazmi42/strmat)
[](https://github.com/arshadkazmi42/strmat/blob/master/LICENSE)
[](https://github.com/arshadkazmi42/strmat/graphs/contributors)
[](https://github.com/arshadkazmi42/strmat/commits/master)Node plugin for string formatting with dynamic values like python
## Install
```
npm install strmat
```or
```
yarn add strmat
```## Usage
```js
const Strmat = require('strmat');const string = 'This will {0} using dynamic {1}';
const values = ['format', 'queries'];
const formattedString = Strmat.format(string, values);// Output:
// This will format using dyamic queriesconst string = 'This will {firstKey} using dynamic {secondKey}';
const values = {
'firstKey': 'format',
'secondKey': 'queries'
};
const formattedString = Strmat.format(string, values);// Output:
// This will format using dyamic queriesconst string = 'This will not use dynamic values';
const values = {};
const formattedString = Strmat.format(string, values);// Output
// This will not use dynamic valuesconst string = 'This will not use dynamic values';
const values = [];
const formattedString = Strmat.format(string, values);// Output
// This will not use dynamic valuesconst string = undefined;
const values = ['format'];
const formattedString = Strmat.format(string, values);// Output
// undefined
```## Contributing
Interested in contributing to this project?
You can log any issues or suggestion related to this library [here](https://github.com/arshadkazmi42/strmat/issues/new).Read our contributing [guide](CONTRIBUTING.md) to get started with contributing to the codebase.