source: trip-planner-front/node_modules/regjsgen/README.md@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1# regjsgen [![Build status][travis-ci-img]][travis-ci] [![Code coverage status][codecov-img]][codecov]
2
3Generate regular expressions from [regjsparser][regjsparser]’s AST.
4
5## Installation
6
7```sh
8npm i regjsgen
9```
10
11## API
12
13### `regjsgen.generate(ast)`
14
15This function accepts an abstract syntax tree representing a regular expression (see [regjsparser][regjsparser]), and returns the generated regular expression string.
16
17```js
18const regjsparser = require('regjsparser');
19const regjsgen = require('regjsgen');
20
21// Generate an AST with `regjsparser`.
22let ast = regjsparser.parse(regex);
23
24// Modify AST
25// …
26
27// Generate `RegExp` string with `regjsgen`.
28let regex = regjsgen.generate(ast);
29```
30
31## Support
32
33Tested in Node.js 0.10, 0.12, 4, 6, 8, 10, 12 and 14.<br>
34Compatible with regjsparser v0.6.4’s AST.
35
36
37[travis-ci]: https://travis-ci.org/bnjmnt4n/regjsgen
38[travis-ci-img]: https://travis-ci.org/bnjmnt4n/regjsgen.svg?branch=master
39[codecov]: https://codecov.io/gh/bnjmnt4n/regjsgen
40[codecov-img]: https://codecov.io/gh/bnjmnt4n/regjsgen/branch/master/graph/badge.svg
41[regjsparser]: https://github.com/jviereck/regjsparser
Note: See TracBrowser for help on using the repository browser.