8000 Use `noop` instead of `alwaysUndefined`. · lodash/lodash@d3ef5a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3ef5a3

Browse files
committed
Use noop instead of alwaysUndefined.
1 parent 5098d63 commit d3ef5a3

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

test/test.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494
alwaysFalse = function() { return false; };
9595

9696
var alwaysNaN = function() { return NaN; },
97-
alwaysNull = function() { return null; },
98-
alwaysUndefined = function() { return undefined; };
97+
alwaysNull = function() { return null; };
9998

10099
var alwaysZero = function() { return 0; },
101100
alwaysOne = function() { return 1; },
@@ -1283,7 +1282,7 @@
12831282
}));
12841283

12851284
defineProperty(object, 'b', lodashStable.assign({}, descriptor, {
1286-
'get': alwaysUndefined
1285+
'get': noop
12871286
}));
12881287

12891288
defineProperty(object, 'c', lodashStable.assign({}, descriptor, {
@@ -1359,7 +1358,7 @@
13591358
assert.expect(1);
13601359

13611360
var expected = { 'a': undefined };
1362-
assert.deepEqual(func({}, expected, alwaysUndefined), expected);
1361+
assert.deepEqual(func({}, expected, noop), expected);
13631362
});
13641363
});
13651364

@@ -8139,7 +8138,7 @@
81398138
assert.expect(1);
81408139

81418140
var values = [null, undefined],
8142-
expected = lodashStable.map(values, alwaysUndefined);
8141+
expected = lodashStable.map(values, noop);
81438142

81448143
var actual = lodashStable.map(values, function(value) {
81458144
try {
@@ -14126,7 +14125,7 @@
1412614125
assert.expect(1);
1412714126

1412814127
var values = falsey.concat([[]]),
14129-
expected = lodashStable.map(values, alwaysUndefined);
14128+
expected = lodashStable.map(values, noop);
1413014129

1413114130
var actual = lodashStable.map(values, function(value, index) {
1413214131
try {
@@ -14867,7 +14866,7 @@
1486714866

1486814867
var source1 = { 'a': { 'b': { 'c': 1 } } },
1486914868
source2 = { 'a': { 'b': { 'd': 2 } } },
14870-
actual = _.mergeWith({}, source1, source2, alwaysUndefined);
14869+
actual = _.mergeWith({}, source1, source2, noop);
1487114870

1487214871
assert.deepEqual(source1.a.b, { 'c': 1 });
1487314872
});
@@ -14974,7 +14973,7 @@
1497414973
assert.expect(2);
1497514974

1497614975
var values = [, null, undefined],
14977-
expected = lodashStable.map(values, alwaysUndefined);
14976+
expected = lodashStable.map(values, noop);
1497814977

1497914978
lodashStable.each(['constructor', ['constructor']], function(path) {
1498014979
var method = _.method(path);
@@ -14991,7 +14990,7 @@
1499114990
assert.expect(2);
1499214991

1499314992
var values = [, null, undefined],
14994-
expected = lodashStable.map(values, alwaysUndefined);
14993+
expected = lodashStable.map(values, noop);
1499514994

1499614995
lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) {
1499714996
var method = _.method(path);
@@ -15129,7 +15128,7 @@
1512915128
assert.expect(2);
1513015129

1513115130
var values = [, null, undefined],
15132-
expected = lodashStable.map(values, alwaysUndefined);
15131+
expected = lodashStable.map(values, noop);
1513315132

1513415133
lodashStable.each(['constructor', ['constructor']], function(path) {
1513515134
var actual = lodashStable.map(values, function(value, index) {
@@ -15145,7 +15144,7 @@
1514515144
assert.expect(2);
1514615145

1514715146
var values = [, null, undefined],
15148-
expected = lodashStable.map(values, alwaysUndefined);
15147+
expected = lodashStable.map(values, noop);
1514915148

1515015149
lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) {
1515115150
var actual = lodashStable.map(values, function(value, index) {
@@ -15211,7 +15210,7 @@
1521115210
assert.expect(1);
1521215211

1521315212
var values = falsey.concat([[]]),
15214-
expected = lodashStable.map(values, alwaysUndefined);
15213+
expected = lodashStable.map(values, noop);
1521515214

1521615215
var actual = lodashStable.map(values, function(value, index) {
1521715216
try {
@@ -15762,7 +15761,7 @@
1576215761
assert.expect(1);
1576315762

1576415763
var values = empties.concat(true, new Date, _, 1, /x/, 'a'),
15765-
expected = lodashStable.map(values, alwaysUndefined);
15764+
expected = lodashStable.map(values, noop);
1576615765

1576715766
var actual = lodashStable.map(values, function(value, index) {
1576815767
return index ? _.noop(value) : _.noop();
@@ -17386,7 +17385,7 @@
1738617385
assert.expect(2);
1738717386

1738817387
var values = [, null, undefined],
17389-
expected = lodashStable.map(values, alwaysUndefined);
17388+
expected = lodashStable.map(values, noop);
1739017389

1739117390
lodashStable.each(['constructor', ['constructor']], function(path) {
1739217391
var prop = _.property(path);
@@ -17403,7 +17402,7 @@
1740317402
assert.expect(2);
1740417403

1740517404
var values = [, null, undefined],
17406-
expected = lodashStable.map(values, alwaysUndefined);
17405+
expected = lodashStable.map(values, noop);
1740717406

1740817407
lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) {
1740917408
var prop = _.property(path);
@@ -17518,7 +17517,7 @@
1751817517
assert.expect(2);
1751917518

1752017519
var values = [, null, undefined],
17521-
expected = lodashStable.map(values, alwaysUndefined);
17520+
expected = lodashStable.map(values, noop);
1752217521

1752317522
lodashStable.each(['constructor', ['constructor']], function(path) {
1752417523
var actual = lodashStable.map(values, function(value, index) {
@@ -17534,7 +17533,7 @@
1753417533
assert.expect(2);
1753517534

1753617535
var values = [, null, undefined],
17537-
expected = lodashStable.map(values, alwaysUndefined);
17536+
expected = lodashStable.map(values, noop);
1753817537

1753917538
lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) {
1754017539
var actual = lodashStable.map(values, function(value, index) {
@@ -17748,7 +17747,7 @@
1774817747

1774917748
assert.deepEqual(actual, expected);
1775017749

17751-
expected = lodashStable.map(values, alwaysUndefined),
17750+
expected = lodashStable.map(values, noop),
1775217751
actual = _.at(array, values);
1775317752

1775417753
assert.deepEqual(actual, expected);
@@ -18234,7 +18233,7 @@
1823418233
assert.expect(1);
1823518234

1823618235
var actual = [],
18237-
expected = lodashStable.map(empties, alwaysUndefined);
18236+
expected = lodashStable.map(empties, noop);
1823818237

1823918238
lodashStable.each(empties, function(value) {
1824018239
try {
@@ -18760,7 +18759,7 @@
1876018759
assert.expect(2);
1876118760

1876218761
var values = [null, undefined],
18763-
expected = lodashStable.map(values, alwaysUndefined),
18762+
expected = lodashStable.map(values, noop),
1876418763
paths = ['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']];
1876518764

1876618765
lodashStable.each(paths, function(path) {
@@ -19168,7 +19167,7 @@
1916819167
QUnit.test('should return `undefined` when sampling empty collections', function(assert) {
1916919168
assert.expect(1);
1917019169

19171-
var expected = lodashStable.map(empties, alwaysUndefined);
19170+
var expected = lodashStable.map(empties, noop);
1917219171

1917319172
var actual = lodashStable.transform(empties, function(result, value) {
1917419173
try {
@@ -19301,7 +19300,7 @@
1930119300
QUnit.test('should work with a `customizer` that returns `undefined`', function(assert) {
1930219301
assert.expect(1);
1930319302

19304-
var actual = _.setWith({}, 'a[0].b.c', 4, alwaysUndefined);
19303+
var actual = _.setWith({}, 'a[0].b.c', 4, noop);
1930519304
assert.deepEqual(actual, { 'a': [{ 'b': { 'c': 4 } }] });
1930619305
});
1930719306
}());
@@ -24182,7 +24181,7 @@
2418224181
QUnit.test('should work with a `customizer` that returns `undefined`', function(assert) {
2418324182
assert.expect(1);
2418424183

24185-
var actual = _.updateWith({}, 'a[0].b.c', alwaysFour, alwaysUndefined);
24184+
var actual = _.updateWith({}, 'a[0].b.c', alwaysFour, noop);
2418624185
assert.deepEqual(actual, { 'a': [{ 'b': { 'c': 4 } }] });
2418724186
});
2418824187
}());

0 commit comments

Comments
 (0)
0