# jex-block-parser

> parse blocks of text based on indentation

Latest version **1.0.0** (published 2020-01-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install jex-block-parser
pnpm add jex-block-parser
yarn add jex-block-parser
bun add jex-block-parser
```

## 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 | 2020-01-15 |
| First published | 2020-01-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeremy Greer |
| Maintainers | reergymerej |
| Keywords | parse, block, parser, block parser, indentation, indent |

## Links

- npm: https://www.npmjs.com/package/jex-block-parser
- npm.io page: https://npm.io/package/jex-block-parser

## 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

- 1.0.0 (latest) — 2020-01-15

## README

# jex-block-parser

Partition text based on indentation.

[![Build Status](https://travis-ci.org/reergymerej/block-parser.svg?branch=master)](https://travis-ci.org/reergymerej/block-parser)


## Usage

```js
const { parse } = require('jex-block-parser')

let input = `
hello
world
`

parse(input)

[ { scope: 'hello', children: [] },
  { scope: 'world', children: [] } ]
```

### Deep

We don't care about blank lines or the [type of
indentation](https://softwareengineering.stackexchange.com/questions/57/tabs-versus-spaces-what-is-the-proper-indentation-character-for-everything-in-e).
```js
input = `
fruits
  apple
    gala
    pink lady
  pear

  cherry
    white

veggies
  kale
    red russian

  cabbage
  radish
`

parse(input)

[ { scope: 'fruits',
    children:
     [ { scope: '  apple',
         children:
          [ { scope: '    gala', children: [] },
            { scope: '    pink lady', children: [] } ] },
       { scope: '  pear', children: [] },
       { scope: '  cherry',
         children: [ { scope: '    white', children: [] } ] } ] },
  { scope: 'veggies',
    children:
     [ { scope: '  kale',
         children: [ { scope: '    red russian', children: [] } ] },
       { scope: '  cabbage', children: [] },
       { scope: '  radish', children: [] } ] } ]
```

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