Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
788 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | # RegJSParser
|
---|
| 2 |
|
---|
| 3 | Parsing the JavaScript's RegExp in JavaScript.
|
---|
| 4 |
|
---|
| 5 | ## Installation
|
---|
| 6 |
|
---|
| 7 | ```bash
|
---|
| 8 | npm install regjsparser
|
---|
| 9 | ```
|
---|
| 10 |
|
---|
| 11 | ## Usage
|
---|
| 12 |
|
---|
| 13 | ```js
|
---|
| 14 | var parse = require('regjsparser').parse;
|
---|
| 15 |
|
---|
| 16 | var parseTree = parse('^a'); // /^a/
|
---|
| 17 | console.log(parseTree);
|
---|
| 18 |
|
---|
| 19 | // Toggle on/off additional features:
|
---|
| 20 | var parseTree = parse('^a', '', {
|
---|
| 21 | // SEE: https://github.com/jviereck/regjsparser/pull/78
|
---|
| 22 | unicodePropertyEscape: true,
|
---|
| 23 |
|
---|
| 24 | // SEE: https://github.com/jviereck/regjsparser/pull/83
|
---|
| 25 | namedGroups: true,
|
---|
| 26 |
|
---|
| 27 | // SEE: https://github.com/jviereck/regjsparser/pull/89
|
---|
| 28 | lookbehind: true
|
---|
| 29 | });
|
---|
| 30 | console.log(parseTree);
|
---|
| 31 | ```
|
---|
| 32 |
|
---|
| 33 | ## Testing
|
---|
| 34 |
|
---|
| 35 | To run the tests, run the following command:
|
---|
| 36 |
|
---|
| 37 | ```bash
|
---|
| 38 | npm test
|
---|
| 39 | ```
|
---|
| 40 |
|
---|
| 41 | To create a new reference file, execute…
|
---|
| 42 |
|
---|
| 43 | ```bash
|
---|
| 44 | node test/update-fixtures.js
|
---|
| 45 | ```
|
---|
| 46 |
|
---|
| 47 | …from the repo top directory.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.