Skip to content

Commit

Permalink
refactor function to helper file
Browse files Browse the repository at this point in the history
  • Loading branch information
BushraAbdullahi committed Sep 5, 2024
1 parent 5159527 commit 68b90e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/helpers.ts/splitName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function formatName(name: string) {
let splitName = name.replace(/\*|\s+/g, "%")

if (!splitName.endsWith("%")) {
splitName = `${splitName}%`
}

return splitName
}
11 changes: 1 addition & 10 deletions src/services/listCourtCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ import User from "./entities/User"
import filterByReasonAndResolutionStatus from "./filters/filterByReasonAndResolutionStatus"
import courtCasesByOrganisationUnitQuery from "./queries/courtCasesByOrganisationUnitQuery"
import leftJoinAndSelectTriggersQuery from "./queries/leftJoinAndSelectTriggersQuery"

function formatName(name: string) {
let splitName = name.replace(/\*|\s+/g, "%")

if (!splitName.endsWith("%")) {
splitName = `${splitName}%`
}

return splitName
}
import { formatName } from "helpers.ts/splitName"

const listCourtCases = async (
connection: DataSource,
Expand Down

0 comments on commit 68b90e9

Please sign in to comment.