Extensions class

Some util and extension functions

Methods

isMemoryInterface(any)

Patch method TODO: is there any better solution? To judge if an object is implements MemoryInterface. Same with 'is MemoryInterface' in C#

randomNext(MemoryInterface, number, number)

Generator random seed and value from properties. If value is not null, the mock random value result would be: min + (value % (max - min)).

Method Details

isMemoryInterface(any)

Patch method TODO: is there any better solution? To judge if an object is implements MemoryInterface. Same with 'is MemoryInterface' in C#

static function isMemoryInterface(obj: any): boolean

Parameters

obj

any

The object to evaluate.

Returns

boolean

True if the object implements MemoryInterface; False if it isn't.

randomNext(MemoryInterface, number, number)

Generator random seed and value from properties. If value is not null, the mock random value result would be: min + (value % (max - min)).

static function randomNext(memory: MemoryInterface, min: number, max: number): number

Parameters

memory
MemoryInterface

memory state.

min

number

The inclusive lower bound of the random number returned.

max

number

The exclusive upper bound of the random number returned. max must be greater than or equal to min.

Returns

number

Random value.