Namespace: util

parasql.util

Miscellaneous utility functions.

Methods

(static) formatDate(num, fmtStr) → {string}

Parameters:
Name Type Description
num number A number representing the primitive value of a Date object e.g. new Date().valueOf()
fmtStr string A date format string
Returns:
The date formatted into a string as specified by fmtStr
Type
string

(static) formatNumber(num, fmtStr) → {string}

Parameters:
Name Type Description
num number
fmtStr string A valid format string
Returns:
The number formatted into a string as specified by fmtStr
Type
string

(static) newRandomKeyAsHex(lengthInBits) → {string}

Uses strong crypto to generate a new random key represented in Hex string format. 128 bits yields 32 chars, 256 bits yields 64 chars.
Parameters:
Name Type Description
lengthInBits number The length of the key in bits.
Since:
  • v78
Returns:
Returns the new random key as a hex string.
Type
string

(static) newRandomUUID() → {string}

Generates a new random UUID. The UUID is RFC4122 version 4 compliant.
Returns:
A new random UUID as a 36 character long string.
Type
string