documentcloud / documentcloud/underscore-contrib

Improved API to mapArgs?

Open
#124 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

after modules question
Dominant language
JavaScript
Stars
622
Forks
114
PR merge metrics
No merged PRs in 30d

Description

I'm wondering if it would be better to have _.mapArgs not be curried. As of right now it is used like so:

squareAndDouble = _.mapArgs(doubleNum)(square);
squareAndDouble(3);
// => 18

However, I'd find the following more intuitive.

squareAndDouble = _.mapArgs(doubleNum, square);
squareAndDouble(3);
// => 18

This keeps the typical Underscore pattern of putting the "operand" value first, and the "operator" value second within one call. Is there a compelling reason to use the curried version @fogus ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the _.mapArgs implementation and inspect its existing uses to understand the current curried API. Compare those uses with the proposed two-argument form; done means the project has an agreed API direction and corresponding behavior, with compatibility expectations clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.