Skip to content

Commit 538108b

Browse files
committed
Slightly shorter.
1 parent aad1b18 commit 538108b

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

d3.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,35 @@ d3 = function() {
2323
d3.min = function(array, f) {
2424
var i = -1, n = array.length, a, b;
2525
if (arguments.length === 1) {
26-
while (++i < n && ((a = array[i]) == null || !(a <= a))) a = undefined;
26+
while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
2727
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
2828
} else {
29-
while (++i < n && ((a = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
29+
while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
3030
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
3131
}
3232
return a;
3333
};
3434
d3.max = function(array, f) {
3535
var i = -1, n = array.length, a, b;
3636
if (arguments.length === 1) {
37-
while (++i < n && ((a = array[i]) == null || !(a <= a))) a = undefined;
37+
while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
3838
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
3939
} else {
40-
while (++i < n && ((a = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
40+
while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
4141
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
4242
}
4343
return a;
4444
};
4545
d3.extent = function(array, f) {
4646
var i = -1, n = array.length, a, b, c;
4747
if (arguments.length === 1) {
48-
while (++i < n && ((a = c = array[i]) == null || !(a <= a))) a = c = undefined;
48+
while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined;
4949
while (++i < n) if ((b = array[i]) != null) {
5050
if (a > b) a = b;
5151
if (c < b) c = b;
5252
}
5353
} else {
54-
while (++i < n && ((a = c = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
54+
while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
5555
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
5656
if (a > b) a = b;
5757
if (c < b) c = b;

d3.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/arrays/extent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ d3.extent = function(array, f) {
55
b,
66
c;
77
if (arguments.length === 1) {
8-
while (++i < n && ((a = c = array[i]) == null || !(a <= a))) a = c = undefined;
8+
while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined;
99
while (++i < n) if ((b = array[i]) != null) {
1010
if (a > b) a = b;
1111
if (c < b) c = b;
1212
}
1313
} else {
14-
while (++i < n && ((a = c = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
14+
while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
1515
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
1616
if (a > b) a = b;
1717
if (c < b) c = b;

src/arrays/max.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ d3.max = function(array, f) {
44
a,
55
b;
66
if (arguments.length === 1) {
7-
while (++i < n && ((a = array[i]) == null || !(a <= a))) a = undefined;
7+
while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
88
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
99
} else {
10-
while (++i < n && ((a = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
10+
while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
1111
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
1212
}
1313
return a;

src/arrays/min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ d3.min = function(array, f) {
44
a,
55
b;
66
if (arguments.length === 1) {
7-
while (++i < n && ((a = array[i]) == null || !(a <= a))) a = undefined;
7+
while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
88
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
99
} else {
10-
while (++i < n && ((a = f.call(array, array[i], i)) == null || !(a <= a))) a = undefined;
10+
while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
1111
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
1212
}
1313
return a;

0 commit comments

Comments
 (0)