Skip to content

marihachi/carol-js

Repository files navigation

carol-js

A small tool for building regular expressions.
We build a RegExp object by combining functions.
We only support ES modules.

Example

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

Installation

npm i carol-js

Test

git clone https://github.com/marihachi/carol-js.git
cd carol-js
npm i
npm run build
npm test

License

MIT