0.1.30 • Published 4 months ago
@trenskow/parse v0.1.30
@trenskow/parse
A small library for parsing a string into a tree.
Usage
Below is an example on how to use the library.
import parse from '@trenskow/parse';
parse('${', '}', { /* options */ }).do('This ${is ${my ${nested ${string}}}}');
The above example will return the following structure
[
'This ', [
'is ', [
'my ', [
'nested ',
'string'
]
]
]
]
One caveat: opening and closing token cannot be the same.
Options
The following options are available.
Name | Description | Type | Default value |
---|---|---|---|
maxDepth | Do not parse under a certain depth. | Number | Infinity |
ignoreInside | A string (or array of strings) indicating characters at which to ignore parsing in between (see example below). | String or Array of String | [] |
ignoreInside
An example of ignore inside is this.
parse('[', ']', { ignoreInside: '"' }).do('This is ["my custom [string]"]')
// ➡ [ 'This is ', '"my custom [string]"' ]
License
See license in LICENSE.
0.1.30
4 months ago
0.1.29
5 months ago
0.1.28
6 months ago
0.1.27
7 months ago
0.1.25
7 months ago
0.1.26
7 months ago
0.1.23
9 months ago
0.1.24
9 months ago
0.1.22
9 months ago
0.1.21
10 months ago
0.1.20
11 months ago
0.1.19
1 year ago
0.1.18
1 year ago
0.1.16
1 year ago
0.1.17
1 year ago
0.1.10
2 years ago
0.1.11
2 years ago
0.1.12
2 years ago
0.1.13
2 years ago
0.1.14
2 years ago
0.1.15
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.9
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.0
3 years ago