optimize partial and partialRight to correctly process rest args#2941
optimize partial and partialRight to correctly process rest args#2941adispring wants to merge 3 commits into
Conversation
| var foo = (a, b, c, d, ...rest) => ({ a, b, c, d, rest }); | ||
| var f = R.partial(foo, [100, 200]); | ||
| eq(f(1, 2, 3, 4), { a: 100, b: 200, c: 1, d: 2, rest: [3, 4] }); | ||
| }); |
There was a problem hiding this comment.
So long as we're supporting ES5, I don't think we can include this test.
There was a problem hiding this comment.
So how should I modify the test, should these test files stay as before?
There was a problem hiding this comment.
I think we should remove the tests for ...rest and add one for the version of greet that inspired #2940. That should show the behavior well enough.
There was a problem hiding this comment.
As this way?:
const greet = (salutation, title, firstName, lastName) =>
salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);
greetMsJaneJones('Hello', 'Mr.' 'Green'); //=> 'Hello, Ms. Jane Jones!'
There was a problem hiding this comment.
Has changed the test as you suggested.
| var f = R.partialRight(foo, [100, 200]); | ||
| eq(f(1, 2, 3, 4), { a: 1, b: 2, c: 100, d: 200, rest: [3, 4] }); | ||
| }); | ||
| }); |
|
This looks good to me. Others? @ramda/core? |
|
@adispring: Another issue that's been dropped. This should go in. Could you resolve the conflicts with the current HEAD? |
|
Ok, I will resolve the conflict soon. |
4a7c9ac to
0987d0a
Compare
|
The conflict has been resolved. |
@CrossEye Optimize partial and partialRight as you suggested.
related to #2940