The compiler for writing next generation JavaScript.
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 Patreon!
Our top sponsors are shown below! [Become a sponsor]
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
// ES2015 arrow function
[1, 2, 3].map((n) => n + 1);
Out
[1, 2, 3].map(function(n) {
return n + 1;
});
Try it out at our REPL.
Mostly a handful of volunteers, funded by you! Please check out our team page!
I'm so glad you asked: Hallelujah โโ In Praise of Babel by @angus-c, audio version by @swyx. Tweet us your recordings!
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.
Check out our website: babeljs.io, and report issues/features at babel/website.
Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!
Check out:
- Our #development Slack channel and say hi (signup)!
- Issues with the good first issue and help wanted label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
Some resources:
- Our CONTRIBUTING.md to get started with setting up the repo.
- Our discussions/notes/roadmap: babel/notes
- Our progress on TC39 proposals: babel/proposals
- Our blog which contains release posts and explanations: /blog
- Our videos page with talks about open source and Babel: /videos
- Our podcast
The Babel repo is managed as a monorepo that is composed of many npm packages.
This plugin extends Babel with support for default values in objects and arrays, using else
clauses. It's part of the effort to make JavaScript more expressive and adaptable.
- Support for new
else
syntax in object and array expressions. - Integration with custom runtime classes like
DefaultObject
andDefaultVector
. - Fully configurable fallback behavior for missing keys or indices.
Input
const obj = {
a: 1,
b: 2,
else (key) => 0
};
Output
const obj = new DefaultObject({
a: 1,
b: 2
}, (key) => 0);