Skip to content

Commit 23c835a

Browse files
committed
Rename requires to previous
1 parent b9892ac commit 23c835a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/unit.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function handleUnit(
1515
name: string,
1616
lessons: Record<
1717
string,
18-
{ next: string[]; requires: string[]; requireAll?: boolean }
18+
{ next: string[]; previous: string[]; requireAll?: boolean }
1919
>,
2020
): Promise<void> {
2121
// First, we need to figure out what the actual ID of our unit is.
@@ -43,36 +43,36 @@ export async function handleUnit(
4343
// Next, we need to go through the lessons and map from friendly names to ids.
4444
const map: Record<
4545
string,
46-
{ next: string[]; requires: string[]; requireAll: boolean }
46+
{ next: string[]; previous: string[]; requireAll: boolean }
4747
> = {};
4848

4949
for (const key in lessons) {
5050
// Map the key.
5151
const newKey = await mapKey(key, state);
5252

53-
// Map next and requires.
53+
// Map next and previous.
5454
const next = lessons[key].next;
55-
const requires = lessons[key].requires;
55+
const previous = lessons[key].previous;
5656

5757
if (typeof next !== "object" || !Array.isArray(next))
5858
throw new Error("next must be a string array!");
59-
if (typeof requires !== "object" || !Array.isArray(requires))
60-
throw new Error("requires must be a string array!");
59+
if (typeof previous !== "object" || !Array.isArray(previous))
60+
throw new Error("previous must be a string array!");
6161

6262
const newNext: string[] = [];
63-
const newRequires: string[] = [];
63+
const newPrevious: string[] = [];
6464

6565
for (const item of next) {
6666
newNext.push(await mapKey(item, state));
6767
}
6868

69-
for (const item of requires) {
70-
newRequires.push(await mapKey(item, state));
69+
for (const item of previous) {
70+
newPrevious.push(await mapKey(item, state));
7171
}
7272

7373
map[newKey] = {
7474
next: newNext,
75-
requires: newRequires,
75+
previous: newPrevious,
7676
requireAll: Boolean(lessons[key].requireAll),
7777
};
7878
}

0 commit comments

Comments
 (0)