Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-block-scoped-functions

Package Overview
Dependencies
54
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@babel/plugin-transform-block-scoped-functions

Babel plugin to ensure function declarations at the block level are block scoped

    7.23.3latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
23,801,649
increased by3.91%

Weekly downloads

Package description

What is @babel/plugin-transform-block-scoped-functions?

The @babel/plugin-transform-block-scoped-functions npm package is designed to ensure that functions defined within blocks (such as if statements or for loops) are properly scoped to those blocks in environments that may not support this feature natively. This is particularly useful for ensuring compatibility with older browsers or JavaScript environments that do not fully implement ES6 scoping rules.

What are @babel/plugin-transform-block-scoped-functions's main functionalities?

Function Scoping

This feature ensures that functions defined within a block are scoped to that block. This is important for compatibility with ES6, where functions are block-scoped, unlike in ES5 where they are function-scoped. The plugin transforms the code to work correctly in environments that do not support block scoping natively.

"use strict";\n\nif (true) {\n  function foo() { return 1; }\n}\n\nfoo(); // Throws ReferenceError in ES6, transformed code works by scoping function within the block

Other packages similar to @babel/plugin-transform-block-scoped-functions

Changelog

Source

v7.23.3 (2023-11-09)

:bug: Bug Fix
  • babel-plugin-transform-typescript
    • #16071 Strip type-only TS namespaces (@colinaaa)
  • babel-generator
  • babel-compat-data, babel-plugin-bugfix-v8-static-class-fields-redefine-readonly, babel-preset-env
  • babel-plugin-transform-object-super
  • babel-helper-module-transforms, babel-plugin-transform-modules-amd, babel-plugin-transform-modules-commonjs, babel-plugin-transform-modules-umd
:memo: Documentation
  • #16044 docs: Update links in @babel/eslint-parser README (@aryehb)
:house: Internal
  • babel-core, babel-preset-env
:running_woman: Performance
:microscope: Output optimization
  • babel-plugin-transform-computed-properties

Readme

Source

@babel/plugin-transform-block-scoped-functions

Babel plugin to ensure function declarations at the block level are block scoped

See our website @babel/plugin-transform-block-scoped-functions for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-block-scoped-functions

or using yarn:

yarn add @babel/plugin-transform-block-scoped-functions --dev

Keywords

FAQs

Last updated on 09 Nov 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc