You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
788 B

4 years ago
  1. # RegJSParser
  2. Parsing the JavaScript's RegExp in JavaScript.
  3. ## Installation
  4. ```bash
  5. npm install regjsparser
  6. ```
  7. ## Usage
  8. ```js
  9. var parse = require('regjsparser').parse;
  10. var parseTree = parse('^a'); // /^a/
  11. console.log(parseTree);
  12. // Toggle on/off additional features:
  13. var parseTree = parse('^a', '', {
  14. // SEE: https://github.com/jviereck/regjsparser/pull/78
  15. unicodePropertyEscape: true,
  16. // SEE: https://github.com/jviereck/regjsparser/pull/83
  17. namedGroups: true,
  18. // SEE: https://github.com/jviereck/regjsparser/pull/89
  19. lookbehind: true
  20. });
  21. console.log(parseTree);
  22. ```
  23. ## Testing
  24. To run the tests, run the following command:
  25. ```bash
  26. npm test
  27. ```
  28. To create a new reference file, execute…
  29. ```bash
  30. node test/update-fixtures.js
  31. ```
  32. …from the repo top directory.