Skip to content

Commit c260202

Browse files
committed
Minor polishing
1 parent 52f00f0 commit c260202

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/core/entry/en.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const createLookupWordsEn = (rawSourceStr, withCapitalized = false, mustIncludeO
1515

1616
const { firstWords, linkedWords } = processSourceString(sourceStr);
1717

18+
const firstWord = firstWords?.[0];
1819
const lookupWords = new UniqList();
1920
lookupWords.filer = (s) => s.length >= 2 || s === firstWord;
2021
lookupWords.merge(linkedWords);
2122

22-
const firstWord = firstWords?.[0];
2323
if (firstWord) {
2424
lookupWords.merge(processFirstWord(firstWord));
2525
}
@@ -54,8 +54,10 @@ const generateTitledExpressions = (words) => {
5454
result.push(str);
5555
}
5656

57+
const MAX_TITLED_EXPRESSION_WORDS = 6;
58+
5759
for (let i = 1; ; i++) {
58-
if (i >= words.length || i >= 6) {
60+
if (i >= words.length || i >= MAX_TITLED_EXPRESSION_WORDS) {
5961
break;
6062
}
6163
const w = words[i];

src/main/lib/utils.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ const omap = (object, func, specifiedProps) => {
3333
const areSame = (a, b) => {
3434
// On the assumption that both have the same properties
3535
const props = Object.keys(b);
36-
let same = true;
3736
for (let i = 0; i < props.length; i++) {
3837
const prop = props[i];
3938
if (a[prop] !== b[prop]) {
40-
same = false;
41-
break;
39+
return false;
4240
}
4341
}
44-
return same;
42+
return true;
4543
};
4644

4745
const isInsideRange = (range, position) => {

0 commit comments

Comments
 (0)