new RandomValueHelper()

Description

Defines and registers custom handlebar helper - randomValue

Methods


register() → {void}

Description

Registers randomValue helper

  • If length of randomValue is not specified, set default length to 16
  • If type of randomValue is not specified, set default type to ALPHANUMERIC
  • If uppercase is specified, and is of ALPHABETICAL or ALPHANUMERIC type, add _UPPER to the type
  • If type is UUID, return UUID, else generate a random value with specified type and length
Returns

randomString( length, chars ) → {string}

Description

Generates an random sequence of characters

Parameters
Name Type Description
length number

length of generated string

chars string

A sequence of valid characters for a specified type returned by genCharArray

Returns

A random sequence of characters of specified length


randomFixedInteger( length ) → {number}

Description

Generates an random number of given length

Parameters
Name Type Description
length number

length of number of be generated

Returns

A number of specified length. i.e. 10 digit number: 2341912498


genCharArray( type ) → {string}

Description

Generates an string of characters to be used by randomString function for randomizing.

Parameters
Name Type Description
type string

Type of random value to be generated

Returns

A string of squence of valid characters according to type