Enable Scala lambda style
- Allow a more consice syntax for simple things.
- Scala is a great language (you should take a look at Scala.js)
npm install --save-dev babel-plugin-transform-scala-lambda
Add the following line to your .babelrc file:
{
"plugins": ["transform-scala-lambda"]
}
const sum = [1, 1, 1].reduce(_ + _);
const sum = [1, 1, 1].reduce((a, b) => a + b);
const users = [{ name: "Sven" }, { name: "James" }];
const userNames = users.map(_.name);
const users = [{ name: "Sven" }, { name: "James" }];
const userNames = users.map(u => u.name);