# bluetext

> Blueprints for text! Parses text to a tree according to your rules.

Latest version **0.0.2** (published 2020-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install bluetext
pnpm add bluetext
yarn add bluetext
bun add bluetext
```

## 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.2 |
| Published | 2020-11-17 |
| First published | 2020-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | str1z |
| Maintainers | str1z |
| Keywords | parser, syntax |

## Links

- npm: https://www.npmjs.com/package/bluetext
- Repository: https://github.com/str1z/bluetext
- Homepage: https://github.com/str1z/bluetext#readme
- Issues: https://github.com/str1z/bluetext/issues
- npm.io page: https://npm.io/package/bluetext

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2020-11-17
- 0.0.1 — 2020-11-16

## README

# bluetext

Blueprints for text! Parses text to a tree according to your rules.

## Installation

### Browser

```html
<script src="https://cdn.jsdelivr.net/npm/bluetext"></script>
```

### Node

```sh
npm install bluetext
```

```js
const BlueText = require("bluetext");
```

## Usage

```js
let strings = new BlueText("strings", {
  escape: "\\", // escape character
  start: '"',
  end: '"',
  alter: (res) => res.match,
});

let comments = new BlueText("comments", {
  start: "/\\*",
  end: "\\*/",
  alter: () => BlueText.NONE, // do not add to parent inner.
});

let brackets = new BlueText("brackets", {
  start: "[", // or just use JS regex
  end: "]", // this will get compiled to regex
  alter: (res) => res.match, // alter the result
  rules: [BlueText.SELF, strings, comments],
});

let res = brackets.match('[["Hello"]]');
console.log(res);
```

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