parenthesis

WebJar for parenthesis

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

parenthesis
Last Version

Last Version

3.1.7
Release Date

Release Date

Type

Type

jar
Description

Description

parenthesis
WebJar for parenthesis
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/dy/parenthesis

Download parenthesis

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/parenthesis/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>parenthesis</artifactId>
    <version>3.1.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/parenthesis/
implementation 'org.webjars.npm:parenthesis:3.1.7'
// https://jarcasting.com/artifacts/org.webjars.npm/parenthesis/
implementation ("org.webjars.npm:parenthesis:3.1.7")
'org.webjars.npm:parenthesis:jar:3.1.7'
<dependency org="org.webjars.npm" name="parenthesis" rev="3.1.7">
  <artifact name="parenthesis" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='parenthesis', version='3.1.7')
)
libraryDependencies += "org.webjars.npm" % "parenthesis" % "3.1.7"
[org.webjars.npm/parenthesis "3.1.7"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

parenthesis Build Status

Parse parentheses from a string, return folded arrays.

npm install parenthesis

var parse = require('parenthesis')

// Parse into nested format
parse('a(b[c{d}])')
// ['a(', ['b[', ['c{', ['d'], '}'], ']'], ')']

// Parse into flat format with cross-references
parse('a(b[c{d}])', {
	brackets: ['()'],
	escape: '\\',
	flat: true
})
// ['a(\\1)', 'b[c{d}]']


// Stringify nested format
parse.stringify(['a(', ['b[', ['c{', ['d'], '}'], ']'], ')'])
// 'a(b[c{d}])'

// Stringify flat format with cross-references
parse.stringify(['a(\\1)', 'b[c{d}]'], {flat: true, escape: '\\'})
// 'a(b[c{d}])'

API

tokens = paren.parse(string, brackets|opts?)

Return array with tokens.

Option Default Meaning
brackets ['{}', '[]', '()'] Single brackets string or list of strings to detect brackets. Can be repeating brackets eg. "" or ''.
escape '___' Escape prefix for flat references.
flat false Return flat array instead of nested arrays.

str = paren.stringify(tokens, {flat}?)

Stringify tokens back. Pass {flat: true} flag for flat tokens array.

Related

License

© 2018 Dmitry Yv. MIT License

Versions

Version
3.1.7
3.1.6
3.1.5