Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/max.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import each from './each.js';
export default function max(obj, iteratee, context) {
var result = -Infinity, lastComputed = -Infinity,
value, computed;
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
if (iteratee == null || (typeof iteratee == 'number' && obj != null && typeof obj[0] != 'object')) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
Expand Down
2 changes: 1 addition & 1 deletion modules/min.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import each from './each.js';
export default function min(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, computed;
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
if (iteratee == null || (typeof iteratee == 'number' && obj != null && typeof obj[0] != 'object')) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
Expand Down
4 changes: 4 additions & 0 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@
assert.strictEqual(_.max(null), -Infinity, 'can handle null/undefined');
assert.strictEqual(_.max(void 0), -Infinity, 'can handle null/undefined');
assert.strictEqual(_.max(null, _.identity), -Infinity, 'can handle null/undefined');
assert.strictEqual(_.max(null, 0), -Infinity, 'can handle null/undefined with a numeric iteratee');
assert.strictEqual(_.max(void 0, 0), -Infinity, 'can handle null/undefined with a numeric iteratee');

assert.strictEqual(_.max([1, 2, 3]), 3, 'can perform a regular Math.max');

Expand Down Expand Up @@ -626,6 +628,8 @@
assert.strictEqual(_.min(null), Infinity, 'can handle null/undefined');
assert.strictEqual(_.min(void 0), Infinity, 'can handle null/undefined');
assert.strictEqual(_.min(null, _.identity), Infinity, 'can handle null/undefined');
assert.strictEqual(_.min(null, 0), Infinity, 'can handle null/undefined with a numeric iteratee');
assert.strictEqual(_.min(void 0, 0), Infinity, 'can handle null/undefined with a numeric iteratee');

assert.strictEqual(_.min([1, 2, 3]), 1, 'can perform a regular Math.min');

Expand Down
4 changes: 2 additions & 2 deletions underscore-esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore-esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions underscore-node-f.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ function where(obj, attrs) {
function max(obj, iteratee, context) {
var result = -Infinity, lastComputed = -Infinity,
value, computed;
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
if (iteratee == null || (typeof iteratee == 'number' && obj != null && typeof obj[0] != 'object')) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
Expand All @@ -1520,7 +1520,7 @@ function max(obj, iteratee, context) {
function min(obj, iteratee, context) {
var result = Infinity, lastComputed = Infinity,
value, computed;
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
if (iteratee == null || (typeof iteratee == 'number' && obj != null && typeof obj[0] != 'object')) {
obj = isArrayLike(obj) ? obj : values(obj);
for (var i = 0, length = obj.length; i < length; i++) {
value = obj[i];
Expand Down
2 changes: 1 addition & 1 deletion underscore-node-f.cjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions underscore-umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion underscore-umd.js.map

Large diffs are not rendered by default.

Loading