Skip to content

Commit 052a2fb

Browse files
committed
use unwrap instead
1 parent feea49d commit 052a2fb

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

dictionary/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function build(): Promise<boolean> {
3636
const endDictionary = performance.now();
3737
let dictionary: Dictionary;
3838
if (!result.isError()) {
39-
dictionary = result.array[0];
39+
dictionary = result.unwrap()[0];
4040
} else {
4141
displayError(text, result.errors);
4242
return false;

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function main(): void {
180180

181181
// load custom dictionary
182182
if (!currentDictionary.isError()) {
183-
loadCustomDictionary(currentDictionary.array[0]);
183+
loadCustomDictionary(currentDictionary.unwrap()[0]);
184184
} else {
185185
showDictionaryError();
186186
showMessage(DICTIONARY_LOADING_FAILED_MESSAGE);
@@ -240,7 +240,7 @@ function main(): void {
240240
errorDisplay.innerText = "";
241241
const result = translate(inputTextBox.value);
242242
if (!result.isError()) {
243-
for (const translation of result.array) {
243+
for (const translation of result.unwrap()) {
244244
const list = document.createElement("li");
245245
list.innerHTML = translation;
246246
outputList.appendChild(list);
@@ -350,7 +350,7 @@ function main(): void {
350350
if (!currentDictionary.isError()) {
351351
lastSavedText = customDictionaryTextBox.value;
352352
lastSavedDictionary = currentDictionary;
353-
loadCustomDictionary(currentDictionary.array[0]);
353+
loadCustomDictionary(currentDictionary.unwrap()[0]);
354354
setIgnoreError(DICTIONARY_KEY, customDictionaryTextBox.value);
355355
customDictionaryDialogBox.close();
356356
} else {

src/repl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (import.meta.main) {
2020
// deno-lint-ignore no-console
2121
console.error(new AggregateError(result.errors));
2222
} else {
23-
const translations = result.array;
23+
const translations = result.unwrap();
2424
for (const translation of translations) {
2525
const count = translation.match(/<strong>/g)?.length ?? 0;
2626
const text = unescape(

src/translator/translator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function translate(tokiPona: string): ArrayResult<string> {
1414
.flatMap(multipleSentences)
1515
.map(EnglishComposer.multipleSentences);
1616
if (!arrayResult.isError()) {
17-
const values = distinct(arrayResult.array);
17+
const values = distinct(arrayResult.unwrap());
1818
if (settings.randomize) {
1919
return new ArrayResult(shuffle(values));
2020
} else {

0 commit comments

Comments
 (0)