Skip to main content
Option: transforms.hoistVariables

What it changes

Moves var declarations to the beginning of their containing function or program without moving initializer evaluation.

Before and after

Configuration

Run this transform by setting transforms.hoistVariables to true:
obfuscate.mjs

View the implementation

Open the TypeScript implementation on GitHub.

Read the behavior tests

Review behavior checks and cases this transform leaves alone.
Last modified on August 29, 2026