Skip to content

Commit 36d362d

Browse files
committed
rename
1 parent 62ca6ff commit 36d362d

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

misc/misc.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ export function mapNullable<const T, const U>(
2121
}
2222
}
2323
export function repeatArray<const T>(
24-
element: T,
24+
value: T,
2525
count: number,
2626
): ReadonlyArray<T> {
27-
return new Array(count).fill(element);
27+
return new Array(count).fill(value);
2828
}
2929
export function repeatWithSpace(text: string, count: number): string {
3030
return repeatArray(text, count).join(" ");
@@ -33,16 +33,16 @@ export function throwError(error: unknown): never {
3333
throw error;
3434
}
3535
export function compound(
36-
elements: ReadonlyArray<string>,
36+
values: ReadonlyArray<string>,
3737
conjunction: string,
3838
repeat: boolean,
3939
): string {
40-
if (repeat || elements.length <= 2) {
41-
return elements.join(` ${conjunction} `);
40+
if (repeat || values.length <= 2) {
41+
return values.join(` ${conjunction} `);
4242
} else {
43-
const lastIndex = elements.length - 1;
44-
const init = elements.slice(0, lastIndex);
45-
const last = elements[lastIndex];
43+
const lastIndex = values.length - 1;
44+
const init = values.slice(0, lastIndex);
45+
const last = values[lastIndex];
4646
const initText = init.map((item) => `${item},`).join(" ");
4747
return `${initText} ${conjunction} ${last}`;
4848
}

src/main.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const WORD_ALREADY_IMPORTED_MESSAGE = "The word is already imported";
6666
const DICTIONARY_ERROR_MESSAGE = "Please fix the errors before saving";
6767

6868
function main() {
69-
// load elements
69+
// load DOM
7070
const inputTextBox = document.getElementById(
7171
"input",
7272
) as HTMLTextAreaElement;
@@ -222,19 +222,19 @@ function main() {
222222
`Errors (${currentDictionary.errors.length}):`;
223223
customDictionaryErrorList.innerHTML = "";
224224
for (const error of currentDictionary.errors) {
225-
const element = document.createElement("li");
226-
element.innerText = error.message;
225+
const list = document.createElement("li");
226+
list.innerText = error.message;
227227
const { position: { position, length } } = error as PositionedError & {
228228
position: { position: number; length: number };
229229
};
230-
element.addEventListener("click", () => {
230+
list.addEventListener("click", () => {
231231
customDictionaryTextBox.focus();
232232
customDictionaryTextBox.setSelectionRange(
233233
position,
234234
position + length,
235235
);
236236
});
237-
customDictionaryErrorList.appendChild(element);
237+
customDictionaryErrorList.appendChild(list);
238238
}
239239
}
240240
// add all event listener

src/settings_frontend.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ function loadOneFromLocalStorage<const T extends keyof Settings>(key: T) {
6969
settings[key],
7070
);
7171
}
72-
function loadOneFromElement<const T extends keyof Settings>(key: T) {
72+
function loadOneFromDom<const T extends keyof Settings>(key: T) {
7373
settings[key] = UPDATERS[key].load(
7474
document.getElementById(toKebabCase(key)) as
7575
| HTMLInputElement
7676
| HTMLSelectElement,
7777
);
7878
setIgnoreError(key, UPDATERS[key].stringify(settings[key]));
7979
}
80-
function setElement<const T extends keyof Settings>(
80+
function setDom<const T extends keyof Settings>(
8181
key: T,
8282
value: Settings[T],
8383
) {
@@ -97,16 +97,16 @@ export function loadFromLocalStorage(): void {
9797
}
9898
export function loadFromDom(): void {
9999
for (const key of KEYS) {
100-
loadOneFromElement(key);
100+
loadOneFromDom(key);
101101
}
102102
}
103103
export function resetDomToCurrent(): void {
104104
for (const key of KEYS) {
105-
setElement(key, settings[key]);
105+
setDom(key, settings[key]);
106106
}
107107
}
108108
export function resetDomToDefault(): void {
109109
for (const key of KEYS) {
110-
setElement(key, defaultSettings[key]);
110+
setDom(key, defaultSettings[key]);
111111
}
112112
}

src/translator/fixer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function fixMultipleDeterminers(
9595
];
9696
} else {
9797
throw new AggregateError(
98-
errors.map((element) => new FilteredError(element())),
98+
errors.map((message) => new FilteredError(message())),
9999
);
100100
}
101101
}

0 commit comments

Comments
 (0)