Skip to content

Commit

Permalink
change all functions to arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinOtten committed Nov 2, 2024
1 parent 5500082 commit 304bc8f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/sportlink-to-mailchimp-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SportlinkToMailchimpConverter {
public constructor(private readonly config: SportlinkToMailchimpConverterConfig) {
}

public async convertFileToPreview(file: LocalFile): Promise<PreviewResult<MailchimpSubscriber>> {
public convertFileToPreview = async (file: LocalFile): Promise<PreviewResult<MailchimpSubscriber>> => {
return this.parseFileAndConvert(file).then((value) => {
return {
columns: Object.getOwnPropertyNames(mailchimpSubscriberProperties),
Expand All @@ -25,7 +25,7 @@ export class SportlinkToMailchimpConverter {
})
}

public async convertFileToOutput(file: LocalFile): Promise<OutputResult<string>> {
public convertFileToOutput = async (file: LocalFile): Promise<OutputResult<string>> => {
return this.parseFileAndConvert(file).then((value) => {
return {
mimetype: 'text/csv;charset=utf-8;',
Expand All @@ -34,12 +34,12 @@ export class SportlinkToMailchimpConverter {
})
}

private async parseFileAndConvert(file: LocalFile): Promise<MailchimpSubscriber[]> {
private parseFileAndConvert = async (file: LocalFile): Promise<MailchimpSubscriber[]> => {
const rows = await parseCsv(file)
return sportlinkContactsToMailchimpSubscribers(
rows
.filter(row => !isNullOrEmpty(row['E-mail']))
.map((row) => sportlinkRowToContact.call(this, row, this.config))
.map((row) => sportlinkRowToContact(row, this.config))
)
}
}
Expand Down Expand Up @@ -76,7 +76,7 @@ const sportlinkRowToContact = (row: SportlinkRow, config: SportlinkToMailchimpCo
}

// If not tagged yet, assume Athletics
if (tags.length == 0) {
if (tags.length === 0) {
tags.push(`Atletiek ${stripGender(categorie)}`)
}

Expand Down Expand Up @@ -118,8 +118,7 @@ const contactGroupToMailchimpContact = (email: string, contacts: SportlinkContac
}
}

const parseCsv = (file: LocalFile) => new Promise<SportlinkRow[]>((resolve, reject) => {

const parseCsv = async (file: LocalFile) => new Promise<SportlinkRow[]>((resolve, reject) => {
const config: Papa.ParseLocalConfig<SportlinkRow, LocalFile> = {
skipEmptyLines: true,
dynamicTyping: true,
Expand Down

0 comments on commit 304bc8f

Please sign in to comment.