Allow placeholders to persist through more than 1 curried call.

This commit is contained in:
John-David Dalton
2016-02-20 16:53:08 -08:00
parent d64583b743
commit 2b8b63e59f
2 changed files with 83 additions and 32 deletions

View File

@@ -3612,6 +3612,16 @@
assert.deepEqual(curried(ph, ph, ph, 4)(ph, ph, 3)(ph, 2)(1), [1, 2, 3, 4]);
});
QUnit.test('should persist placeholders', function(assert) {
assert.expect(1);
var curried = _.curry(fn),
ph = curried.placeholder,
actual = curried(ph, ph, ph, 'd')('a')(ph)('b')('c');
assert.deepEqual(actual, ['a', 'b', 'c', 'd']);
});
QUnit.test('should provide additional arguments after reaching the target arity', function(assert) {
assert.expect(3);
@@ -3745,6 +3755,16 @@
assert.deepEqual(curried(ph, ph, ph, 4)(ph, ph, 3)(ph, 2)(1), expected);
});
QUnit.test('should persist placeholders', function(assert) {
assert.expect(1);
var curried = _.curryRight(fn),
ph = curried.placeholder,
actual = curried('a', ph, ph, ph)('b')(ph)('c')('d');
assert.deepEqual(actual, ['a', 'b', 'c', 'd']);
});
QUnit.test('should provide additional arguments after reaching the target arity', function(assert) {
assert.expect(3);