0.1.4 • Published 2 years ago

babel-plugin-super-function-js v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

💪 Super Function JS

NPM Version GitHub license

Babel plugin to give super powers to your JavaScript functions. Inspired by functional programming languages such as Haskell.

Usage

  1. Install plugin: npm install --save-dev babel-plugin-super-function-js
  2. Add the following plugin to your .babelrc file,
  "overrides": [{
    "test": "**/*.sf.js",
    "plugins": ["babel-plugin-super-function-js"]
  }]
  1. 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);
0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago