Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
style: 🎨 variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-wang0 committed May 15, 2024
1 parent 97ffea0 commit e6f1b5f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions services/departments-terms-scraper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ async function fetchWebSoc() {
return load(body);
}

async function getDepartments($: CheerioAPI): Promise<string[]> {
async function getDepartments(webSocContent: CheerioAPI): Promise<string[]> {
const $ = webSocContent;

const departments: string[] = [];
$('select[name="Dept"] option').each((_index, element) => {
const deptText = $(element).text().trim();
Expand All @@ -20,7 +22,9 @@ async function getDepartments($: CheerioAPI): Promise<string[]> {
return departments;
}

async function getTerms($: CheerioAPI): Promise<string[]> {
async function getTerms(webSocContent: CheerioAPI): Promise<string[]> {
const $ = webSocContent;

const terms: string[] = [];
$('select[name="YearTerm"] option').each((_index, element) => {
const termText = $(element).text().trim();
Expand All @@ -31,12 +35,14 @@ async function getTerms($: CheerioAPI): Promise<string[]> {
}

async function getDepartmentsTerms() {
const $ = await fetchWebSoc();
const webSocContent = await fetchWebSoc();

const terms = await getTerms($);
const departments = await getDepartments($);
const terms = await getTerms(webSocContent);
const departments = await getDepartments(webSocContent);

return { departments, terms };
}

getDepartmentsTerms().then(console.log);

export default getDepartmentsTerms;

0 comments on commit e6f1b5f

Please sign in to comment.