ItemGenerator

Methods

GetArray(An) → {Object}

Generates array according to specified scheme.

Source:
Parameters:
Name Type Description
An Dynamic

array with desired object types.

{ propertyName1 : "propertyType1" propertyName2 : "propertyType2" ... propertyNameN : "propertyTypeN" }

Returns:
Type:
Object

An array according to specified scheme.

GetAssocArray(scheme) → {Object}

Generates associative array according to specified scheme.

Source:
Parameters:
Name Type Description
scheme Dynamic

A scheme with desired object structure. Can be any simple type, array of types or associative array in form

{ propertyName1 : "propertyType1" propertyName2 : "propertyType2" ... propertyNameN : "propertyTypeN" }

Returns:
Type:
Object

An associative array according to specified scheme.

GetBoolean() → {Boolean}

Generates random boolean value.

Source:
Returns:
Type:
Boolean

A random boolean value.

GetFloat() → {float}

Generates random float value.

Source:
Returns:
Type:
float

A random float value.

GetInteger(seed) → {integer}

Generates random integer value from 1 to specified seed value.

Source:
Parameters:
Name Type Description
seed Dynamic

seed value for Rnd function.

Returns:
Type:
integer

A random integer value.

GetItem(scheme) → {Object}

Gets an item according to the schem

Source:
Parameters:
Name Type Description
scheme Dynamic

A scheme with desired object structure. Can be any simple type, array of types or associative array in form

{ propertyName1 : "propertyType1" propertyName2 : "propertyType2" ... propertyNameN : "propertyTypeN" }

Returns:
Type:
Object

An object according to specified scheme or invalid if scheme is not one of simple type, array or associative array.

GetSimpleType(typeStr) → {Object}

Generates random value of specified type

Source:
Parameters:
Name Type Description
typeStr Dynamic

name of desired object type.

Returns:
Type:
Object

A simple type object or invalid if type is not supported.

GetString(seed) → {string}

Generates random string with specified length.

Source:
Parameters:
Name Type Description
seed Dynamic

A string length

Returns:
Type:
string

A random string value or empty string if seed is 0.

ItemGenerator(scheme) → {Object}

Creates an ItemGenerator instance

Source:
Parameters:
Name Type Description
scheme Dynamic

A scheme with desired object structure. Can be any simple type, array of types or associative array in form

{ propertyName1 : "propertyType1" propertyName2 : "propertyType2" ... propertyNameN : "propertyTypeN" }

Returns:
Type:
Object

An object according to specified scheme or invalid, if scheme is not valid.