Skip to content

Commit a3c2c66

Browse files
authoredApr 23, 2022
Merge pull request #2953 from jgonggrijp/extendscript-precedence
Parenthesize mixed expressions of || and &&
2 parents 0557e33 + c4e0920 commit a3c2c66

13 files changed

+48
-40
lines changed
 

‎modules/.eslintrc

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,13 @@
88
],
99
"extends": [
1010
"plugin:import/errors"
11-
]
11+
],
12+
"rules": {
13+
"no-mixed-operators": [
14+
"error",
15+
{
16+
"groups": [["&&", "||"]]
17+
}
18+
]
19+
}
1220
}

‎modules/_collectNonEnumProps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function collectNonEnumProps(obj, keys) {
2525
keys = emulatedSet(keys);
2626
var nonEnumIdx = nonEnumerableProps.length;
2727
var constructor = obj.constructor;
28-
var proto = isFunction(constructor) && constructor.prototype || ObjProto;
28+
var proto = (isFunction(constructor) && constructor.prototype) || ObjProto;
2929

3030
// Constructor is a special case.
3131
var prop = 'constructor';

‎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
}

‎modules/unzip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import pluck from './pluck.js';
55
// Complement of zip. Unzip accepts an array of arrays and groups
66
// each array's elements on shared indices.
77
export default function unzip(array) {
8-
var length = array && max(array, getLength).length || 0;
8+
var length = (array && max(array, getLength).length) || 0;
99
var result = Array(length);
1010

1111
for (var index = 0; index < length; index++) {

‎underscore-esm.js

+9-9
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

+9-9
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?
@@ -257,7 +257,7 @@ function collectNonEnumProps(obj, keys) {
257257
keys = emulatedSet(keys);
258258
var nonEnumIdx = nonEnumerableProps.length;
259259
var constructor = obj.constructor;
260-
var proto = isFunction$1(constructor) && constructor.prototype || ObjProto;
260+
var proto = (isFunction$1(constructor) && constructor.prototype) || ObjProto;
261261

262262
// Constructor is a special case.
263263
var prop = 'constructor';
@@ -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
}
@@ -1765,7 +1765,7 @@ function intersection(array) {
17651765
// Complement of zip. Unzip accepts an array of arrays and groups
17661766
// each array's elements on shared indices.
17671767
function unzip(array) {
1768-
var length = array && max(array, getLength).length || 0;
1768+
var length = (array && max(array, getLength).length) || 0;
17691769
var result = Array(length);
17701770

17711771
for (var index = 0; index < length; index++) {

‎underscore-node-f.cjs.map

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

‎underscore-umd.js

+9-9
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.