Skip to content

Suggestion for ES6 Harmony #3

Open
@churchie317

Description

@churchie317

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);
    }
  };
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions