mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 04:17:49 +00:00
Add _.ary test case for multiple applied arys.
This commit is contained in:
@@ -5019,7 +5019,7 @@
|
|||||||
* may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
|
* may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
|
||||||
* modify function arguments, making the order in which they are executed important,
|
* modify function arguments, making the order in which they are executed important,
|
||||||
* preventing the merging of metadata. However, we make an exception for a safe
|
* preventing the merging of metadata. However, we make an exception for a safe
|
||||||
* common case where curried functions have `_.ary` and or `_.rearg` applied.
|
* combined case where curried functions have `_.ary` and or `_.rearg` applied.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} data The destination metadata.
|
* @param {Array} data The destination metadata.
|
||||||
@@ -5030,7 +5030,7 @@
|
|||||||
var bitmask = data[1],
|
var bitmask = data[1],
|
||||||
srcBitmask = source[1],
|
srcBitmask = source[1],
|
||||||
newBitmask = bitmask | srcBitmask,
|
newBitmask = bitmask | srcBitmask,
|
||||||
isCommon = newBitmask < ARY_FLAG;
|
isCommon = newBitmask < ARY_FLAG || newBitmask == ARY_FLAG;
|
||||||
|
|
||||||
var isCombo =
|
var isCombo =
|
||||||
(srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) ||
|
(srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) ||
|
||||||
|
|||||||
@@ -1054,6 +1054,13 @@
|
|||||||
assert.deepEqual(capped('a'), ['a']);
|
assert.deepEqual(capped('a'), ['a']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should use the existing `ary` if smaller', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var capped = _.ary(_.ary(fn, 1), 2);
|
||||||
|
assert.deepEqual(capped('a', 'b', 'c'), ['a']);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
|
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user