Skip to content

Commit

Permalink
style: 🎨 code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-wang0 committed May 15, 2024
1 parent 28da895 commit d1321d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { load } from "cheerio";
import fetch from "cross-fetch";

async function loadWebSoc() {
async function fetchWebSoc() {
const response = await fetch("https://www.reg.uci.edu/perl/WebSoc");
const body = await response.text();
return load(body);
}

export async function getDepartments(): Promise<string[]> {
const $ = await loadWebSoc();
const $ = await fetchWebSoc();

const departments: string[] = [];
$('select[name="Dept"] option').each((_index, element) => {
Expand All @@ -23,7 +23,7 @@ export async function getDepartments(): Promise<string[]> {
}

export async function getTerms(): Promise<string[]> {
const $ = await loadWebSoc();
const $ = await fetchWebSoc();

const terms: string[] = [];
$('select[name="YearTerm"] option').each((_index, element) => {
Expand All @@ -33,6 +33,3 @@ export async function getTerms(): Promise<string[]> {

return terms;
}

getDepartments().then(console.log);
getTerms().then(console.log);

0 comments on commit d1321d6

Please sign in to comment.