Home Manual Reference Source Test Repository
public class | source

HalsteadArray

Provides a wrapper around an array of Halstead property object hashes which should contain an identifier field and potentially a filter field.

Constructor Summary

Public Constructor
public

constructor(metric: string, data: Array<object | string>)

Initializes HalsteadArray by normalizing any Halstead properties converting them into TraitHalstead instances.

Member Summary

Public Members
public get

Returns the length of wrapped TraitHalstead data.

public get

Returns the associated metric type.

public get

type: string: *

Returns the typeof data being wrapped.

Private Members
private

Stores an array of normalized Halstead property data to an object hash that has an identifier entry.

private

Stores the Halstead metric type.

Method Summary

Public Methods
public

forEach(callback: function, thisArg: object)

Allows custom processing of TraitHalstead data.

public

Returns a TraitHalstead entry at the given index.

public

valueOf(params: *): Array<string>

Returns an array of evaluated TraitHalstead data as the value of the identifier field of the wrapped data.

Public Constructors

public constructor(metric: string, data: Array<object | string>) source

Initializes HalsteadArray by normalizing any Halstead properties converting them into TraitHalstead instances.

Params:

NameTypeAttributeDescription
metric string

The name of Halstead metric being stored.

data Array<object | string>

An array of Halstead properties.

Public Members

public get length: number: * source

Returns the length of wrapped TraitHalstead data.

Return:

number

public get metric: string: * source

Returns the associated metric type.

Return:

string

public get type: string: * source

Returns the typeof data being wrapped.

Return:

string

Private Members

private _data: Array<TraitHalstead> source

Stores an array of normalized Halstead property data to an object hash that has an identifier entry.

private _metric: string source

Stores the Halstead metric type.

Public Methods

public forEach(callback: function, thisArg: object) source

Allows custom processing of TraitHalstead data.

Params:

NameTypeAttributeDescription
callback function

A custom method to process each TraitHalstead data.

thisArg object

The this this scope to run callback with.

public get(index: number): TraitHalstead source

Returns a TraitHalstead entry at the given index.

Params:

NameTypeAttributeDescription
index number

Index to access.

Return:

TraitHalstead

public valueOf(params: *): Array<string> source

Returns an array of evaluated TraitHalstead data as the value of the identifier field of the wrapped data. Additionally the TraitHalstead filter function is invoked with the given parameters removing any values that fail the filter test.

Params:

NameTypeAttributeDescription
params *

Provides parameters which are forwarded onto any data stored as a function. Normally params should be the current AST node, parent AST node, ... optional data.

Return:

Array<string>