Skip to content

Commit 825e9c2

Browse files
committedApr 4, 2022
Parenthesize mixed expressions of || and && (fix #2949)
ExtendScript apparently gives equal precedence to the || and && operators, so when the || appears before the &&, we need to anchor the order of evaluation with an extra pair of parentheses.
1 parent 0557e33 commit 825e9c2

10 files changed

+31
-31
lines changed
 

‎modules/_setup.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export var VERSION = '1.13.2';
44
// Establish the root object, `window` (`self`) in the browser, `global`
55
// on the server, or `this` in some virtual machines. We use `self`
66
// instead of `window` for `WebWorker` support.
7-
export var root = typeof self == 'object' && self.self === self && self ||
8-
typeof global == 'object' && global.global === global && global ||
7+
export var root = (typeof self == 'object' && self.self === self && self) ||
8+
(typeof global == 'object' && global.global === global && global) ||
99
Function('return this')() ||
1010
{};
1111

‎modules/isObject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Is a given variable an object?
22
export default function isObject(obj) {
33
var type = typeof obj;
4-
return type === 'function' || type === 'object' && !!obj;
4+
return type === 'function' || (type === 'object' && !!obj);
55
}

‎modules/max.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import each from './each.js';
77
export default function max(obj, iteratee, context) {
88
var result = -Infinity, lastComputed = -Infinity,
99
value, computed;
10-
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
10+
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
1111
obj = isArrayLike(obj) ? obj : values(obj);
1212
for (var i = 0, length = obj.length; i < length; i++) {
1313
value = obj[i];
@@ -19,7 +19,7 @@ export default function max(obj, iteratee, context) {
1919
iteratee = cb(iteratee, context);
2020
each(obj, function(v, index, list) {
2121
computed = iteratee(v, index, list);
22-
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
22+
if (computed > lastComputed || (computed === -Infinity && result === -Infinity)) {
2323
result = v;
2424
lastComputed = computed;
2525
}

‎modules/min.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import each from './each.js';
77
export default function min(obj, iteratee, context) {
88
var result = Infinity, lastComputed = Infinity,
99
value, computed;
10-
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
10+
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
1111
obj = isArrayLike(obj) ? obj : values(obj);
1212
for (var i = 0, length = obj.length; i < length; i++) {
1313
value = obj[i];
@@ -19,7 +19,7 @@ export default function min(obj, iteratee, context) {
1919
iteratee = cb(iteratee, context);
2020
each(obj, function(v, index, list) {
2121
computed = iteratee(v, index, list);
22-
if (computed < lastComputed || computed === Infinity && result === Infinity) {
22+
if (computed < lastComputed || (computed === Infinity && result === Infinity)) {
2323
result = v;
2424
lastComputed = computed;
2525
}

‎underscore-esm.js

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore-esm.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore-node-f.cjs

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var VERSION = '1.13.2';
1111
// Establish the root object, `window` (`self`) in the browser, `global`
1212
// on the server, or `this` in some virtual machines. We use `self`
1313
// instead of `window` for `WebWorker` support.
14-
var root = typeof self == 'object' && self.self === self && self ||
15-
typeof global == 'object' && global.global === global && global ||
14+
var root = (typeof self == 'object' && self.self === self && self) ||
15+
(typeof global == 'object' && global.global === global && global) ||
1616
Function('return this')() ||
1717
{};
1818

@@ -80,7 +80,7 @@ function restArguments(func, startIndex) {
8080
// Is a given variable an object?
8181
function isObject(obj) {
8282
var type = typeof obj;
83-
return type === 'function' || type === 'object' && !!obj;
83+
return type === 'function' || (type === 'object' && !!obj);
8484
}
8585

8686
// Is a given value equal to null?
@@ -1460,7 +1460,7 @@ function where(obj, attrs) {
14601460
function max(obj, iteratee, context) {
14611461
var result = -Infinity, lastComputed = -Infinity,
14621462
value, computed;
1463-
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
1463+
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
14641464
obj = isArrayLike(obj) ? obj : values(obj);
14651465
for (var i = 0, length = obj.length; i < length; i++) {
14661466
value = obj[i];
@@ -1472,7 +1472,7 @@ function max(obj, iteratee, context) {
14721472
iteratee = cb(iteratee, context);
14731473
each(obj, function(v, index, list) {
14741474
computed = iteratee(v, index, list);
1475-
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
1475+
if (computed > lastComputed || (computed === -Infinity && result === -Infinity)) {
14761476
result = v;
14771477
lastComputed = computed;
14781478
}
@@ -1485,7 +1485,7 @@ function max(obj, iteratee, context) {
14851485
function min(obj, iteratee, context) {
14861486
var result = Infinity, lastComputed = Infinity,
14871487
value, computed;
1488-
if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
1488+
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
14891489
obj = isArrayLike(obj) ? obj : values(obj);
14901490
for (var i = 0, length = obj.length; i < length; i++) {
14911491
value = obj[i];
@@ -1497,7 +1497,7 @@ function min(obj, iteratee, context) {
14971497
iteratee = cb(iteratee, context);
14981498
each(obj, function(v, index, list) {
14991499
computed = iteratee(v, index, list);
1500-
if (computed < lastComputed || computed === Infinity && result === Infinity) {
1500+
if (computed < lastComputed || (computed === Infinity && result === Infinity)) {
15011501
result = v;
15021502
lastComputed = computed;
15031503
}

‎underscore-node-f.cjs.map

+1-1
Large diffs are not rendered by default.

‎underscore-umd.js

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore-umd.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.