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

Advantage of using apply #1

Open
tw00 opened this issue Mar 13, 2019 · 0 comments
Open

Advantage of using apply #1

tw00 opened this issue Mar 13, 2019 · 0 comments

Comments

@tw00
Copy link

tw00 commented Mar 13, 2019

Hi,
this little library turned out very helpful for a project I'm working on. One thing though is not 100% clear to me. Is there any reason to use Function.apply over just calling a and b directly?

Currently I'm using this adaption of the function:

function joint( a ) {
  var b = a[(a.length - 1)];
  a.pop();

  a = a.length > 1 ? joint( a ) : a[0];

  return function(...args) {
    return b( a(...args) )
  };
}

It also also allows to pass arguments through the joint functions.

Cheers, Thomas

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

1 participant