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/character.md | |
download | langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.gz langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.bz2 langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.zip |
Commit
Diffstat (limited to 'src/node_modules/chance/docs/basics/character.md')
-rw-r--r-- | src/node_modules/chance/docs/basics/character.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/node_modules/chance/docs/basics/character.md b/src/node_modules/chance/docs/basics/character.md new file mode 100644 index 0000000..6c90ed6 --- /dev/null +++ b/src/node_modules/chance/docs/basics/character.md @@ -0,0 +1,65 @@ +# character + +```js +// usages +chance.character() +chance.character({ pool: 'abcde' }) +chance.character({ alpha: true }) +chance.character({ numeric: true }) +chance.character({ casing: 'lower' }) +chance.character({ symbols: true }) +``` + +Return a random character. + +```js +chance.character(); +=> 'v' +``` + +By default it will return a string with random character from the following +pool. + +```js +'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()' +``` + +Optionally specify a pool and the character will be generated with characters +only from that pool. + +```js +chance.character({ pool: 'abcde' }); +=> 'c' +``` + +Optionally specify alpha for an alphabetic character. + +```js +chance.character({ alpha: true }); +=> 'N' +``` + +Optionally specify numeric for a numeric character. + +```js +chance.character({ numeric: true }); +=> '8' +``` + +Default includes both upper and lower case. It's possible to specify one or the +other. + +```js +chance.character({ casing: 'lower' }); +=> 'j' +``` + +*Note, wanted to call this key just ```case``` but unfortunately that's a +reserved word in JavaScript for use in a switch statement* + +Optionally return only symbols + +```js +chance.character({ symbols: true }); +=> '%' +``` |