1
|
# RegJSGen
|
2
|
|
3
|
Generate `RegExp`s from [RegJSParser](https://github.com/jviereck/regjsparser)’s AST.
|
4
|
|
5
|
## Installation
|
6
|
|
7
|
```bash
|
8
|
npm install --save regjsgen
|
9
|
```
|
10
|
|
11
|
## Usage
|
12
|
|
13
|
```js
|
14
|
var regjsgen = require('regjsgen');
|
15
|
// With `regjsparser`
|
16
|
var regjsparser = require('regjsparser');
|
17
|
var regex = '^a$';
|
18
|
var ast = regjsparser.parse(regex);
|
19
|
// Modify AST
|
20
|
// ...
|
21
|
// Regenerate `RegExp`
|
22
|
regex = regjsgen.generate(ast);
|
23
|
```
|
24
|
|
25
|
## See Also
|
26
|
|
27
|
* [RegJSParser](https://github.com/jviereck/regjsparser)
|
28
|
* [RegExp.js](https://github.com/jviereck/regexp.js)
|
29
|
|
30
|
## Testing
|
31
|
|
32
|
Run the command
|
33
|
|
34
|
```bash
|
35
|
npm test
|
36
|
```
|
37
|
|
38
|
To create a new reference file, execute
|
39
|
|
40
|
```bash
|
41
|
node test/update-fixture.js
|
42
|
```
|
43
|
|
44
|
from the repo top directory.
|
45
|
|
46
|
## Support
|
47
|
|
48
|
Tested in Node.js 0.8.26~0.10.30.
|
49
|
|
50
|
## Author
|
51
|
|
52
|
| [![twitter/demoneaux](http://gravatar.com/avatar/029b19dba521584d83398ada3ecf6131?s=70)](https://twitter.com/demoneaux "Follow @demoneaux on Twitter") |
|
53
|
|---|
|
54
|
| [Benjamin Tan](http://d10.github.io/) |
|
55
|
|
56
|
## Contributors
|
57
|
|
58
|
| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
59
|
|---|
|
60
|
| [Mathias Bynens](http://mathiasbynens.be/) |
|