Skip to main content

HalsteadArray

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

Index

Constructors

constructor

  • new HalsteadArray(metric: string, data: any): default
  • Initializes HalsteadArray by normalizing any Halstead properties converting them into TraitHalstead instances.


    Parameters

    • metric: string

      The name of Halstead metric being stored.

    • data: any

      An array of Halstead properties.

    Returns default

Accessors

length

  • get length(): number
  • Returns the length of wrapped TraitHalstead data


    Returns number

metric

  • get metric(): string
  • Returns the associated metric type.


    Returns string

type

  • get type(): string | number | bigint | boolean | symbol | undefined | object | function
  • Returns the typeof data being wrapped.


    Returns string | number | bigint | boolean | symbol | undefined | object | function

Methods

forEach

  • forEach(callback: () => void, thisArg: any): void
  • Allows custom processing of TraitHalstead data.


    Parameters

    • callback: () => void

      A custom method to process each TraitHalstead data.

    • thisArg: any

      The this this scope to run callback with.

    Returns void

get

  • get(index: number): default
  • Returns a TraitHalstead entry at the given index.


    Parameters

    • index: number

      Index to access.

    Returns default

valueOf

  • valueOf(...params: any): string[]
  • 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.


    Parameters

    • rest...params: any

      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.

    Returns string[]