# unpack-string

> Unpacks the content found within a text, delimited by an opening char and a closing char, e.g., 'Can extract (only the content found here within these parentheses)'

Latest version **0.0.4** (published 2017-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install unpack-string
pnpm add unpack-string
yarn add unpack-string
bun add unpack-string
```

Provides the command `unpack-string`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2017-11-09 |
| First published | 2017-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Diego ZoracKy |
| Maintainers | diegozoracky |
| Keywords | unpack, string, brackets, parentheses |

## Links

- npm: https://www.npmjs.com/package/unpack-string
- npm.io page: https://npm.io/package/unpack-string

## Dependencies (1)

- [magicli](https://npm.io/package/magicli.md) 0.0.8

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2017-11-09
- 0.0.3 — 2017-11-09
- 0.0.2 — 2017-05-28
- 0.0.1 — 2017-05-28

## README

# unpack-string

[![Build Status](https://api.travis-ci.org/DiegoZoracKy/unpack-string.svg)](https://travis-ci.org/DiegoZoracKy/unpack-string)

Unpacks the content found within a text, delimited by an opening char and a closing char, e.g., *'Can extract (**only the content found here within these parentheses**)'*

**Node.js** and **Browser** ready.

## Installation

```bash
npm install unpack-string
```
**CLI**
```bash
npm install unpack-string -g
```
```bash
npx unpack-string --help
```

## Usage

It will extract the content found within the *opening char* and the *closing char* defined as parameters. If the parameter **openingChar** is not passed in, it will try to guess the first occurrence of some of these known chars `'([{<'`, and, when the parameter **closingChar** is not passed in, it will try to guess some of these chars `')]}>'`, to match the **openingChar**.

## Examples

```javascript
const unpackString = require('unpack-string');

const str = 'Can extract (only the content [found {here} within] these parentheses)!!';

{
	const result = unpackString(str);

	// Guessing openingChar and closingChar. "()" in that case.
	// result === 'only the content [found {here} within] these parentheses'
}

{
	const openingChar = '[';
	const result = unpackString(str, openingChar);

	// Guessing closingChar: "]"
	// result === 'found {here} within'
}

{
	const openingChar = '{';
	const closingChar = ']';
	const result = unpackString(str, openingChar, closingChar);

	// Defining any openingChar and closingChar
	// result === 'here} within'
}
```

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