kakasoo / regexp-manager

type-safe regexp pattern builder
https://www.npmjs.com/package/regexp-manager
MIT License
21 stars 0 forks source link

Processing when using async functions inside the method #2

Open kakasoo opened 1 year ago

kakasoo commented 1 year ago

The creation of a regular expression can also be determined after accessing the DB. Therefore, it is necessary to operate the builder pattern after all asynchronous functions are completed externally, in which case the logical flow of writing the regular expression is separated, resulting in a difference between the flow of reading the code and the actual flow of motion. Therefore, if you call an asynchronous function internally, it would be better to have a grammar that forces it to work synchronously.

kakasoo commented 1 year ago

example code.

new RegExpPatternBuilder().and(async() => { return 'abc' }).expression; // 'abc'