Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marihachi/carol-js
A small tool for building regular expressions.
https://github.com/marihachi/carol-js
builder regex regular-expression utility
Last synced: 2 months ago
JSON representation
A small tool for building regular expressions.
- Host: GitHub
- URL: https://github.com/marihachi/carol-js
- Owner: marihachi
- License: mit
- Created: 2023-11-16T15:06:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-27T08:37:50.000Z (about 1 year ago)
- Last Synced: 2024-10-04T19:16:07.798Z (3 months ago)
- Topics: builder, regex, regular-expression, utility
- Language: JavaScript
- Homepage:
- Size: 77.1 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# carol-js
A small tool for building regular expressions.
We build a RegExp object by combining functions.
We only support ES modules.## Example
```js
import carol from 'carol-js';const regex = carol.seq([
carol(/hello/),
carol(/ /),
carol(/world/),
carol(/!/).many(1),
]).many().toRegex();assert.strictEqual(regex.source, '(?:hello world(?:!)+)*');
```## Documents
- [API reference](https://github.com/marihachi/carol-js/blob/3e5d29ffe37d7b4b827bbd59e3133627cac06e76/doc/api.md)
- [Usage](https://github.com/marihachi/carol-js/blob/3e5d29ffe37d7b4b827bbd59e3133627cac06e76/doc/usage.md)## Installation
```sh
npm i carol-js
```## Test
```sh
git clone https://github.com/marihachi/carol-js.git
cd carol-js
npm i
npm run build
npm test
```## License
MIT