Compile-time `with` for strict mode JavaScript
JSON →The `with` package provides a utility to transform JavaScript code, effectively simulating the behavior of the deprecated `with` statement at compile time. This allows developers to safely use `with`-like scoping in strict mode environments and ensures compatibility with minification tools, which typically struggle with native `with`. Currently at version 7.0.2, the package maintains an active release cadence with minor bug fixes and performance improvements following major version updates. Key differentiators include its strict mode compatibility, predictable variable assignment within the generated scope (unlike native `with` which can leak assignments), and the explicit declaration of all non-excluded variables, enabling `if (foo === undefined)` checks. It also offers detailed parsing errors for easier debugging.
Traffic · last 30 days ↓67% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇩🇪 Germany · 🇫🇷 France