Provides a set of helper methods to generate cryptographically strong random values.
Methods (RandomBytesProvider)
Method
Description
nextBytes(size: number)
Return array of random bytes
nextBytesAsync(size: number)
Return promise that resolves to array of random bytes
Methods (Rnd)
Method
Description
nextFloat(qty: number)
Return a random floating-point number or array of random floating-point numbers that is greater than or equal to 0.0, and less than 1.0
nextFloatAsync(qty: number)
Return a promise that resolves to random floating-point number or array of random floating-point numbers that is greater than or equal to 0.0, and less than 1.0
nextInt(min: number, max: number, qty: number)
Return a random integer or array of random integers that is within a specified range
Return a promise that resolves to random integer or array of random integers that is within a specified range
Url
The Url class is used to parse or create from 0 the URL. It gives you different property accessors that allow you easily access or set parts of the URL. Create the Url instance with the uri string or empty to construct it from zero.
Methods
Method
Description
isUrl(value: string)
Return true if provided value can be parsed as valid URI
toString()
Return string representation of the whole URL
toURL()
Return URL object
Accessors
Accessor
Description
protocol
IANA-registered scheme or protocol
domain
Name of the domain or IP address
port
IP port number
username
Username for HTTP Authentication
password
Password for HTTP Authentication
pathString
Route path in form /route/path
pathParams
Route path as array of its parts
path
Route path in form /route/path
queryParams
Map of query params as a key - value. Values are parsed as strings, numbers and booleans
hashFragment
Hash fragment
isSsl
Return true if SSL is used
Running unit tests
Run nx test toolbox to execute the unit tests via Jest.