source: imaps-frontend/node_modules/regjsgen/README.md@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1# regjsgen [![Build status][ci-img]][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 on Node.js 16 and 18.<br>
34Compatible with regjsparser v0.10.0’s AST.
35
36
37[ci]: https://github.com/bnjmnt4n/regjsgen/actions
38[ci-img]: https://github.com/bnjmnt4n/regjsgen/workflows/Node.js%20CI/badge.svg
39[codecov]: https://codecov.io/gh/bnjmnt4n/regjsgen
40[codecov-img]: https://codecov.io/gh/bnjmnt4n/regjsgen/branch/main/graph/badge.svg
41[regjsparser]: https://github.com/jviereck/regjsparser
Note: See TracBrowser for help on using the repository browser.