Transpiles let-block syntax (let (..) {..}) to ES6 or ES3 for block-scoping support in older JavaScript environments.
let-er is a JavaScript transpiler that enables developers to use the explicit `let (..) {..}` block-scoping syntax, which was proposed for ES6 but ultimately rejected. It transforms this syntax into either standard ES6 `let` declarations or an ES3-compatible `try..catch` hack, allowing for more readable and maintainable block-scoped code in current environments.
JavaScript developers who want to write block-scoped code with explicit syntax for better maintainability and performance, especially those targeting ES3+ or ES6 environments and using build steps.
Developers choose let-er because it provides a bridge to use the preferable `let (..) {..}` syntax that was rejected from ES6, offering explicit block-scoping that adheres to the Principle of Least Exposure, with support for both modern ES6 and legacy ES3+ targets.
DEPRECATED: Transpile non-ES6 let-blocks into ES6 (or ES3)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Transpiles the readable `let (..) {..}` syntax into working JavaScript, making block-scoping intentions clear and adhering to the Principle of Least Exposure, as emphasized in the README's philosophy.
Outputs native ES6 `let` declarations by default or ES3-compatible code using a `try..catch` hack, providing flexibility for both modern and legacy environments, as detailed in the options section.
Supports multiple variables in a single `let` block (e.g., `let (x=1, y=2) {..}`), simplifying code structure and reducing boilerplate, as shown in the examples.
Offers `lex()`, `parse()`, and `generate()` methods for custom analysis and transformations, allowing advanced users to integrate with other tools, as described in the API section.
Relies on a syntax that was rejected from ES6, meaning code written with let-er is not valid JavaScript without transpilation, limiting portability and increasing dependency on the tool.
The ES3 polyfill uses `try..catch`, which the README admits is about 10-20% slower than IIFEs and is a hacky solution with potential side-effects, making it less ideal for performance-critical legacy code.
Requires integrating a transpiler into the build process, adding complexity for projects that don't already use tools like Babel, and it only handles the specific `let (..) {..}` syntax, not standard `let` declarations.