Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/netr/nested-text-spinner
Spins a set of nested strings into plain text.
https://github.com/netr/nested-text-spinner
Last synced: about 2 months ago
JSON representation
Spins a set of nested strings into plain text.
- Host: GitHub
- URL: https://github.com/netr/nested-text-spinner
- Owner: netr
- License: mit
- Created: 2019-08-13T09:49:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:25:05.000Z (about 2 years ago)
- Last Synced: 2024-11-08T09:12:21.868Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nested-text-spinner
Spin's a set of nested strings into plain text. Example: `{hello {bob|alice}}` returns `hello bob` or `hello alice`
## Installation
```bash
$ npm install nested-text-spinner
```## Test
```bash
$ npm test
```## How to use
Require
```javascript
const spinner = require('nested-text-spinner');let text = '{hello {bob|alice}}';
let plain = spinner.spin(text);
console.log(plain);//result: hello bob (or) hello alice
```Import
```javascript
import spin from 'nested-text-spinner';let text = '{hello {bob|alice}}';
let plain = spin(text);
console.log(plain);//result: hello bob (or) hello alice
```