-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(random): Adds jsdocs to all random component files
- Loading branch information
Showing
6 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
/** | ||
* Common charsets used for psuedo-random string generation. | ||
* | ||
* Copyright (c) 2018 Joseph R Cowman | ||
* Licensed under MIT License (see https://github.com/regal/regal) | ||
*/ | ||
|
||
// tslint:disable-next-line | ||
true; // This does nothing; it's only so the jsdocs won't conflict | ||
|
||
/** | ||
* Contains all letters (upper- and lower-case), numbers, and some special characters. | ||
* Used for psuedo-random string generation. | ||
*/ | ||
export const EXPANDED_CHARSET = | ||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()-_=+{}[]|;:<>,.?"; | ||
|
||
/** | ||
* Contains all letters (upper- and lower-case) and numbers. | ||
* Used for psuedo-random string generation. | ||
*/ | ||
export const ALHPANUMERIC_CHARSET = | ||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
|
||
/** | ||
* Contains all letters (upper- and lower-case). | ||
* Used for psuedo-random string generation. | ||
*/ | ||
export const ALPHABET_CHARSET = | ||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | ||
|
||
/** | ||
* Contains all numbers. | ||
* Used for psuedo-random string generation. | ||
*/ | ||
export const NUMBERS_CHARSET = "0123456789"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
/** | ||
* Contains generateSeed function and related configuration. | ||
* | ||
* Copyright (c) 2018 Joseph R Cowman | ||
* Licensed under MIT License (see https://github.com/regal/regal) | ||
*/ | ||
|
||
import Prando from "prando"; | ||
import { EXPANDED_CHARSET } from "../charsets"; | ||
|
||
// This results in 89^10 possible seeds | ||
// Note: the following configuration results in 89^10 possible seeds | ||
|
||
/** Default length of seeds generated by `InstanceOptions` when none is specified. */ | ||
export const SEED_LENGTH = 10; | ||
/** Default charset used to generate seeds within `InstanceOptions` when none is specified. */ | ||
export const DEFAULT_SEED_CHARSET = EXPANDED_CHARSET; | ||
|
||
/** | ||
* Generates a psuedo-random seed to use in further psuedo-random data generation. | ||
*/ | ||
export const generateSeed = () => | ||
new Prando().nextString(SEED_LENGTH, DEFAULT_SEED_CHARSET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
/** | ||
* The purpose of this file is to abstract all random-related implementations | ||
* by re-exporting their constructors from a single file. | ||
* | ||
* Copyright (c) 2018 Joseph R Cowman | ||
* Licensed under MIT License (see https://github.com/regal/regal) | ||
*/ | ||
|
||
export { buildInstanceRandom } from "./instance-random-impl"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters