Options
All
  • Public
  • Public/Protected
  • All
Menu

An identifier mangler that leverages character frequency analysis to determine identifier precedence.

Hierarchy

Index

Methods

  • consider(chars: string, delta: number): number
  • Modifies the internal weighting of the input characters by the specified delta. Will be invoked on the entire printed AST, and then deduct mangleable identifiers.

    Parameters

    • chars: string

      The characters to modify the weighting of.

    • delta: number

      The numeric weight to add to the characters.

    Returns number

  • get(n: number): string
  • Obtains the nth most favored (usually shortest) identifier to rename a variable to. The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word. This function is expected to be stable; Evaluating get(n) === get(n) should always return true.

    Parameters

    • n: number

      The ordinal of the identifier.

    Returns string

  • reset(): void
  • Resets character weights.

    Returns void

  • sort(): void
  • Sorts identifiers by character frequency, in preparation for calls to get(n).

    Returns void