/**
* create a curried version of the given function
* @author Aamir khan
* @param {Function} func function to be curried
* @returns {Function} curried version of the given func
*/
const curry = func => {
// define the number of expected arguments
const expectedArgs = func.length
const curried = (...args) =>
// if enough arugments has been passed return the
// result of the function execution, otherwise
// continue adding arguments to the list
args.length >= expectedArgs
? func(...args)
: (...args2) => curried(...args.concat(args2))
return curried
}
export default curry;