netr / nested-text-spinner

Spins a set of nested strings into plain text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nested-text-spinner

Spin's a set of nested strings into plain text. Example: {hello {bob|alice}} returns hello bob or hello alice

Installation

$ npm install nested-text-spinner

Test

$ npm test

How to use

Require

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

import spin from 'nested-text-spinner';

let text = '{hello {bob|alice}}';
let plain = spin(text);
console.log(plain);

//result: hello bob (or) hello alice

About

Spins a set of nested strings into plain text.

License:MIT License


Languages

Language:JavaScript 100.0%