Add iteratee arity hints to forEach methods. [closes #2277]

This commit is contained in:
John-David Dalton
2016-04-23 11:29:52 -07:00
parent 43c26b5d6f
commit fbc91cf7ae
3 changed files with 44 additions and 20 deletions

View File

@@ -1178,6 +1178,35 @@
});
});
});
/*--------------------------------------------------------------------------*/
QUnit.module('forEach methods');
_.each(['forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight'], function(methodName) {
var func = fp[methodName];
QUnit.test('`fp.' + methodName + '` should provide `value` to `iteratee`', function(assert) {
assert.expect(2);
var args;
func(function() {
args || (args = slice.call(arguments));
})(['a']);
assert.deepEqual(args, ['a']);
args = undefined;
func(function() {
args || (args = slice.call(arguments));
})({ 'a': 1 });
assert.deepEqual(args, [1]);
});
});
/*--------------------------------------------------------------------------*/
QUnit.module('fp.getOr');