# string-content-spinner

> String content spinner

Latest version **1.0.0** (published 2018-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install string-content-spinner
pnpm add string-content-spinner
yarn add string-content-spinner
bun add string-content-spinner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-01-02 |
| First published | 2018-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ulflander |
| Maintainers | ulflander |

## Links

- npm: https://www.npmjs.com/package/string-content-spinner
- Repository: https://github.com/heek/string-content-spinner
- Homepage: https://github.com/heek/string-content-spinner#readme
- Issues: https://github.com/heek/string-content-spinner/issues
- npm.io page: https://npm.io/package/string-content-spinner

## Recent versions

- 1.0.0 (latest) — 2018-01-02

## README

# string-content-spinner

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Node.js recursive content spinner algorithm.

### API

#### `spin` function

Spin a string.

Parameters:

```js
spin(stringToSpin: string);
```

Example:

```js
const spin = require('string-content-spinner');

const result = spin('{Hello|Good morning} world');

console.log(result);
```

This will log either `Hello world` or `Good morning`.

#### `factory` function

Generates a new `spin` function with custom section markers and delimiter.

Parameters:

```js
factory(openSectionMarker: string, closeSectionMarker: string, delimiter: string);
```

Example:

```js
// Get factory function
const spinFactory = require('string-content-spinner').factory;

// Generate new spin function with custom section markers and delimiter
const spin = spinFactory('[[', ']]', '::');

// Use it!
const result = spin('Hello [[world::mars]]');

console.log(result);
```

This will log either `Hello world` or `Hello mars`.

### Development

Clone repository, then run `npm install`.

#### NPM commands

- `npm run prettier`: run prettier on source files (both lib and test files)
- `npm run lint`: lint source files (both lib and test files, using `eslint`)
- `npm test` or `npm run test`: run unit tests
- `npm run git-add`: run prettor, lint and unit tests, if all passed, stage changes

---
_Source: https://npm.io/package/string-content-spinner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
