Add _.divide and _.multiply.

This commit is contained in:
John-David Dalton
2016-03-19 21:00:29 -07:00
parent b2bff1ad45
commit 6eb0cb1565
4 changed files with 111 additions and 51 deletions

View File

@@ -929,7 +929,7 @@
var func = fp[methodName],
isAdd = methodName == 'add';
QUnit.test('`fp.' + methodName + '` should have `rearg` applied', function(assert) {
QUnit.test('`fp.' + methodName + '` should not have `rearg` applied', function(assert) {
assert.expect(1);
assert.strictEqual(func('1')('2'), isAdd ? '12' : -1);
@@ -1021,6 +1021,21 @@
/*--------------------------------------------------------------------------*/
QUnit.module('fp.divide and fp.multiply');
_.each(['divide', 'multiply'], function(methodName) {
var func = fp[methodName],
isDivide = methodName == 'divide';
QUnit.test('`fp.' + methodName + '` should not have `rearg` applied', function(assert) {
assert.expect(1);
assert.strictEqual(func('2')('4'), isDivide ? 0.5 : 8);
});
});
/*--------------------------------------------------------------------------*/
QUnit.module('fp.extend');
(function() {

View File

@@ -24677,11 +24677,13 @@
(function() {
var funcs = [
'add',
'camelCase',
'capitalize',
'ceil',
'clone',
'deburr',
'divide',
'endsWith',
'escape',
'escapeRegExp',
@@ -24731,6 +24733,7 @@
'maxBy',
'min',
'minBy',
'multiply',
'pad',
'padEnd',
'padStart',
@@ -24749,6 +24752,7 @@
'some',
'startCase',
'startsWith',
'subtract',
'sum',
'toInteger',
'toLower',
@@ -24770,9 +24774,7 @@
assert.expect(1);
if (!isNpm) {
var array = [1, 2, 3],
actual = _(array)[methodName]();
var actual = _()[methodName]();
assert.notOk(actual instanceof _);
}
else {
@@ -24784,9 +24786,7 @@
assert.expect(1);
if (!isNpm) {
var array = [1, 2, 3],
actual = _(array).chain()[methodName]();
var actual = _().chain()[methodName]();
assert.ok(actual instanceof _);
}
else {
@@ -25012,7 +25012,7 @@
var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey);
QUnit.test('should accept falsey arguments', function(assert) {
assert.expect(305);
assert.expect(307);
var emptyArrays = lodashStable.map(falsey, alwaysEmptyArray);