import TraitHalstead from 'typhonjs-escomplex-commons/src/module/traits/TraitHalstead.js'
TraitHalstead
Provides a wrapper around a data object hash which should contain an identifier
field and potentially a filter
field which is a function. The identifier can be a function or string or an array of functions / strings.
Constructor Summary
Public Constructor | ||
public |
constructor(metric: string, data: object) Initializes the Halstead trait. |
Member Summary
Public Members | ||
public get |
Returns the associated metric type. |
|
public get |
Returns the typeof data being wrapped. |
Private Members | ||
private |
_data: * Stores the data to wrap. |
|
private |
Stores the Halstead metric type. |
Method Summary
Public Methods | ||
public |
Returns the value of the |
|
public |
Returns the value of the |
Public Constructors
Public Members
Private Members
Public Methods
public filter(params: *): boolean source
Returns the value of the filter
field of the wrapped data. If the wrapped filter
field is a function it
is invoked with the given params
otherwise the data is returned directly. If filter
is not defined then
true
is returned.
Params:
Name | Type | Attribute | Description |
params | * | Provides parameters which are forwarded onto any data stored as a function. Normally
|
public valueOf(params: *): * | Array<*> source
Returns the value of the identifier
field of the wrapped data. If the wrapped identifier
field is a function
it is invoked with the given params
otherwise the data is returned directly.
Params:
Name | Type | Attribute | Description |
params | * | Provides parameters which are forwarded onto any data stored as a function. |