Daniel Kezerashvili 40e43f5a14
fix: Duplicate function call in variable destructuring (#13711)
* Add test case demonstrating invalid behavior

* Add conditional check for child properties so RHS is not duplicated

* Add recursive check to find any nested non single-property case

* Add case for array destructuring

* Add test case for a nested rest element

* More safely recurse through array destructuring

* Traverse assignment and nested rest operations

* Refactor to be more clear which case statement we are executing against

* Update missed snapshots

* Update packages/babel-plugin-proposal-object-rest-spread/src/index.js

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>

* Filter null array elements, add early return, remove optional chaining

* Use stronger type assertions

* Update fall through to be false; add early return to RestElement case

* Move hasMoreThanOneBinding to its own file with distinct tests

* Rename testing helper to more appropriately match business logic

* Yarn Dedup & rename hasMoreThanOneBinding to shouldStoreRHSInTemporaryVariable

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-09-07 17:27:52 -04:00
2021-06-10 00:48:57 +02:00
2021-08-04 23:00:40 +02:00
2021-09-02 21:28:31 +00:00
2021-03-19 13:02:51 +01:00
2021-06-11 14:50:51 -04:00
2019-01-07 08:52:11 -06:00
2021-09-04 09:40:42 +02:00
2021-09-04 08:50:23 +00:00
2019-05-25 12:46:59 +02:00
2019-02-18 23:28:26 +05:30

babel

The compiler for writing next generation JavaScript.

Gitpod ready-to-code

v7 npm Downloads v6 npm Downloads

GitHub CI Status Coverage Status Slack Status Follow on Twitter

Supporting Babel

Backers on Open Collective Sponsors on Open Collective Business Strategy Status

Babel (pronounced "babble") is a community-driven project used by many companies and projects, and is maintained by a group of volunteers. If you'd like to help support the future of the project, please consider:

  • Giving developer time on the project. (Message us on Twitter or Slack for guidance!)
  • Giving funds by becoming a sponsor on Open Collective or GitHub (which goes to our Open Collective account)!

Sponsors

Our top sponsors are shown below! [Become a sponsor]

Intro

Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.

In

// ES2020 nullish coalescing
function greet(input) {
  return input ?? "Hello world";
}

Out

function greet(input) {
  return input != null ? input : "Hello world";
}

Try it out at our REPL.

FAQ

Who maintains Babel?

Mostly a handful of volunteers, funded by you! Please check out our team page!

Is there a Babel song?

I'm so glad you asked: Hallelujah —— In Praise of Babel by @angus-c, audio version by @swyx. Tweet us your recordings!

Looking for support?

For questions and support please join our Slack Community (you can sign up here for an invite), ask a question on Stack Overflow, or ping us on Twitter.

Where are the docs?

Check out our website: babeljs.io, and report issues/features at babel/website.

Want to report a bug or request a feature?

Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!

Want to contribute to Babel?

Check out:

Some resources:

How is the repo structured?

The Babel repo is managed as a monorepo that is composed of many npm packages.

License

MIT

Description
No description provided
Readme 79 MiB
Languages
JavaScript 99.5%
Makefile 0.3%
HTML 0.1%