1.0.3 • Published 4 years ago

pattern-string-generator v1.0.3

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

This tiny library allows you to create random Strings, that match a given pattern.

Installation

npm i pattern-string-generator

Usage

The generator uses a set of lists, which can be combined to create a wide range of strings.

In the example above uppercase vovels are mixed with uppercase consonants and some numbers. You can also exclude parts of the pattern from being replaced by surrounding it with / as shown above.

Pre-build Lists

Adding your own List

You can add your own List for replacement to the generator. It can either be a string or an array.

generator.addPatternList('k', 'po', 'ro', 'do')

If you call the pattern method after this line every k in the pattern willbe replaced with either po, ro or do.

Pattern Complexity

If you want to check, how many possible results your pattern can have you can use the patternComplexity method.