Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for ES6 Harmony #3

Open
churchie317 opened this issue Dec 21, 2016 · 3 comments
Open

Suggestion for ES6 Harmony #3

churchie317 opened this issue Dec 21, 2016 · 3 comments

Comments

@churchie317
Copy link
Contributor

churchie317 commented Dec 21, 2016

This repository looks like it's no longer maintained, but I thought I might throw my question out in case anyone in the void is listening.

Is there a specific reason for including the number of arguments the curried function expects as a parameter?

Would a PR to index.es6.js with the following be appreciated?

let _curry = (fn, curryArgs = []) => {
  return (...args) => {
    var concatArgs = [...concatArgs, ...args];

    // If function arity greater than number of received args
    if (fn.length > concatArgs.length) {
      return _curry(fn, concatArgs);
    } else {
      return fn(...concatArgs);
    }
  };
};
@hemanth
Copy link
Member

hemanth commented Dec 21, 2016

Please feel free to do a PR.

It's not dead, but needs no maintenance ;)

@churchie317
Copy link
Contributor Author

Glad to hear this repo isn't dead! Y'all have a cool thing going.

I'll try to do this later today.

@blackChef
Copy link

https://github.com/fp-js/fj-curry/blob/master/index.es6#L3

var concatArgs = [...concatArgs, ...args];

@churchie317 I believe this line should be var concatArgs = [...curryArgs, ...args];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants