Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-destructuring

Package Overview
Dependencies
54
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @babel/plugin-transform-destructuring

Compile ES2015 destructuring to ES5


Version published
Weekly downloads
25M
increased by2.62%
Maintainers
4
Install size
87.2 kB
Created
Weekly downloads
 

Package description

What is @babel/plugin-transform-destructuring?

The @babel/plugin-transform-destructuring npm package is a plugin for Babel, a JavaScript compiler, that enables the transformation of destructuring assignments and rest properties in JavaScript code. This allows for more concise and readable code, especially when dealing with objects or arrays. The plugin is part of the larger Babel ecosystem, which helps developers write next-gen JavaScript today.

What are @babel/plugin-transform-destructuring's main functionalities?

Object Destructuring

Transforms object destructuring syntax into a format that can be understood by environments that do not support ES2015 or later. This feature allows for extracting properties from objects and assigning them to variables in a single statement.

const { a, b } = { a: 1, b: 2 };

Array Destructuring

Enables transformation of array destructuring, which allows for a similar concise syntax for arrays as for objects, extracting values from arrays directly into variables.

const [a, b] = [1, 2];

Nested Destructuring

Supports nested destructuring, which is useful for extracting deeply nested properties or values from objects or arrays into variables at various levels of depth.

const { a: { b, c } } = { a: { b: 1, c: 2 } };

Default Values

Allows for setting default values in destructuring assignments, which is particularly useful when the expected property might not exist in the source object or array.

const { a = 10, b = 5 } = { a: 3 };

Other packages similar to @babel/plugin-transform-destructuring

Changelog

Source

v7.18.9 (2022-07-18)

:bug: Bug Fix
  • babel-plugin-transform-modules-systemjs, babel-types
    • #14763 fix: allow exporting TSDeclareFunction as default (@zxbodya)
  • babel-generator
:nail_care: Polish
:house: Internal
  • babel-core, babel-helper-remap-async-to-generator, babel-helpers, babel-parser, babel-plugin-transform-block-scoping, babel-preset-env
  • babel-helper-create-class-features-plugin, babel-helper-member-expression-to-functions, babel-helper-remap-async-to-generator, babel-helper-replace-supers, babel-helper-wrap-function, babel-helpers, babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining, babel-plugin-proposal-decorators, babel-plugin-proposal-object-rest-spread, babel-plugin-proposal-optional-chaining, babel-plugin-transform-block-scoping, babel-plugin-transform-classes, babel-traverse, babel-types
:running_woman: Performance

Readme

Source

@babel/plugin-transform-destructuring

Compile ES2015 destructuring to ES5

See our website @babel/plugin-transform-destructuring for more information.

Install

Using npm:

npm install --save-dev @babel/plugin-transform-destructuring

or using yarn:

yarn add @babel/plugin-transform-destructuring --dev

Keywords

FAQs

Last updated on 18 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your 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