babel-plugin-super-function-js
v0.1.4
Published
Babel plugin to super power your functions!
Downloads
5
Readme
💪 Super Function JS
Babel plugin to give super powers to your JavaScript functions. Inspired by functional programming languages such as Haskell.
Usage
- Install plugin:
npm install --save-dev babel-plugin-super-function-js
- Add the following plugin to your .babelrc file,
"overrides": [{
"test": "**/*.sf.js",
"plugins": ["babel-plugin-super-function-js"]
}]
- Super function will now transform all functions from files with ".sf.js" extension!
Features
Curried Functions Everywhere!!
Any functions you define will be curried by default. Pass any number of parameters and you'll get back another function.
function calculateFullSalary(base, hra, deductions) {
return base + hra - deductions;
}
calculateFullSalary(1000, 100, 50);
const tempEmpSalaryCalculator = calculateFullSalary(1000);
const fullTimeTempSalary = tempEmpSalaryCalculator(50, 25);
const partTimeTempSalary = tempEmpSalaryCalculator(20, 25);