@cd2/string-from-regex
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Create sample strings based on a regex

npm i --save regex-to-string

yarn add regex-to-string
const builder = new Builder(/a+ regexp?/)

builder.build()  //   =>   aaaaaaaaaaaa regexp
builder.build()  //   =>   aaaaaa regex
builder.build()  //   =>   aaa regexp
builder.build()  //   =>   aaaaaaaaaaaaaaaaaa regexp
builder.build()  //   =>   aaaaaaa regex
builder.build()  //   =>   aaaaaaaaaa regex

Config

Set the maximum number of occurrances meant by + and *:

Builder.INFINITY = 10

Set the highest code point to be used for .:

Builder.MAX_CODE_POINT = 100  // max is 0x10FFFF

TODO

assertions add options to allow generated strings to appear more realistic e.g .build({lowerCase: true})

Readme

Keywords

none

Package Sidebar

Install

npm i @cd2/string-from-regex

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

10.2 kB

Total Files

11

Last publish

Collaborators

  • cd2developers
  • hexmodr
  • smosix