Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

paren

torcado1941.1kMIT1.2.0

a simple nested group parser

parse, paren, parenthesis, parentheses, brackets, nest, nested, group, split

readme

paren

a simple nested group parser

npm i paren

const parse = require('paren');

parse('a (nested (string (of)) words)');
// ["a ", ["nested ", ["string ", ["of"]], " words"]]

parse('a (nested (string (of)) words)', ' ');
// ["a", ["nested", ["string", ["of"]], "words"]]

parse('one,two,three 3 tres,(a {b,(c)},[{d}]) e,[{(f)}]', ',', ['(', '{', '['], [')', '}', ']']);
// ["one","two","three 3 tres",["a ",["b",["c"]],[["d"]]]," e",[[["f"]]]]

// parse an array by item
let left = Symbol('left'),
    right = Symbol('right');

let a = [left, 1, 2, 3, right, left, left, '(group)', right, right];

parse(a, null, left, right);
// [[[1,2,3]],[[["(group)"]]]]