diff options
author | Minteck <contact@minteck.org> | 2021-12-21 16:52:28 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-21 16:52:28 +0100 |
commit | 46e43f4bde4a35785b4997b81e86cd19f046b69b (patch) | |
tree | c53c2f826f777f9d6b2d249dab556feb72a6c3a6 /src/node_modules/chance/docs/basics/template.md | |
download | langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.gz langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.bz2 langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.zip |
Commit
Diffstat (limited to 'src/node_modules/chance/docs/basics/template.md')
-rw-r--r-- | src/node_modules/chance/docs/basics/template.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/node_modules/chance/docs/basics/template.md b/src/node_modules/chance/docs/basics/template.md new file mode 100644 index 0000000..96ba860 --- /dev/null +++ b/src/node_modules/chance/docs/basics/template.md @@ -0,0 +1,27 @@ +# template + +Return a random string matching the given template. + +```js +// usage +chance.template('{AA####}') +=> 'ZQ7803' +chance.template('{Aa}-{##}') +=> 'Vr-78' +chance.template('{####}:{####}:{####}') +=> '1628:5987:7803' +``` + +The template consists of any number of "character replacement" and "character +literal" sequences. A "character replacement" sequence starts with a left +brace, has any number of special replacement characters, and ends with a right +brace. A character literal can be any character except a brace or a backslash. +A literal brace or backslash character can be included in the output by +escaping with a backslash. + +The following replacement characters can be used in a replacement sequence: + + * "#": a random digit + * "a": a random lower case letter + * "A": a random upper case letter + |