Skip to content

Commit f43668b

Browse files
committed
Shortened array length checks
1 parent 8b82ff6 commit f43668b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chatgpt.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ const chatgpt = {
371371
document.removeEventListener('keydown', handlers.dismiss.key) // prevent memory leaks
372372

373373
// Check for pending alerts in queue
374-
if (alertQueue.length > 0) {
374+
if (alertQueue.length) {
375375
const nextAlert = document.getElementById(alertQueue[0])
376376
setTimeout(() => {
377377
nextAlert.style.display = ''
@@ -769,7 +769,7 @@ const chatgpt = {
769769
}}
770770
if (!targetNames.includes(targetName.toLowerCase()))
771771
throw new Error(`Invalid targetName: ${targetName}. `
772-
+ (targetNames.length > 0 ? 'Valid values are: ' + JSON.stringify(targetNames)
772+
+ (targetNames.length ? 'Valid values are: ' + JSON.stringify(targetNames)
773773
: 'targetType ' + targetType.toLowerCase() + ' does not require additional options.'))
774774

775775
// Call target function using pre-validated name components
@@ -1535,7 +1535,7 @@ const chatgpt = {
15351535
elems = [...text.matchAll(reTags)]
15361536

15371537
// Process 1st element to render
1538-
if (elems.length > 0) {
1538+
if (elems.length) {
15391539
const elem = elems[0],
15401540
[tagContent, tagName, tagAttrs, tagText] = elem.slice(0, 4),
15411541
tagNode = document.createElement(tagName) ; tagNode.textContent = tagText

0 commit comments

Comments
 (0)