Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-parameters

Package Overview
Dependencies
54
Maintainers
4
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @babel/plugin-transform-parameters

Compile ES2015 default and rest parameters to ES5


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

Package description

What is @babel/plugin-transform-parameters?

The @babel/plugin-transform-parameters package is a Babel plugin that transforms function parameter features, such as default parameters, destructured parameters, and rest parameters, into ES5-compatible syntax. This transformation allows developers to use modern JavaScript features while maintaining compatibility with older environments that may not support these newer syntaxes natively.

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

Default Parameters

Transforms functions with default parameters to check for `undefined` and assign a default value if necessary. This allows for cleaner function signatures and easier parameter handling.

function log(message = 'Default message') { console.log(message); }

Destructured Parameters

Enables the use of destructuring in function parameters, transforming it into a series of variable assignments for compatibility. This simplifies the extraction of properties from objects passed as function arguments.

function greet({ name, age }) { console.log(`Hello ${name}, you are ${age} years old.`); }

Rest Parameters

Transforms rest parameters into a standard ES5 arguments pattern, allowing functions to accept an indefinite number of arguments as an array.

function concatenate(separator, ...strings) { return strings.join(separator); }

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

Changelog

Source

v7.20.3 (2022-11-07)

:bug: Bug Fix
  • babel-generator
    • #15135 Don't convert line comments containing */ to block comments (@liuxingbaoyu)
  • babel-plugin-transform-parameters
  • babel-parser

Readme

Source

@babel/plugin-transform-parameters

Compile ES2015 default and rest parameters to ES5

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

Install

Using npm:

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

or using yarn:

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

Keywords

FAQs

Last updated on 07 Nov 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