Skip to content

Commit 54a168b

Browse files
More fat-arrows
1 parent 3716210 commit 54a168b

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

β€Žsrc/applyPatches.tsβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ function getInstalledPackageVersion(
5252
.version as PackageVersion
5353
}
5454

55-
export function applyPatchesForApp(appPath: AppPath, reverse: boolean): void {
55+
export const applyPatchesForApp = (
56+
appPath: AppPath,
57+
reverse: boolean,
58+
): void => {
5659
const patchesDirectory = path.join(appPath, "patches") as PatchesDirectory
5760
const files = findPatchFiles(patchesDirectory)
5861

@@ -104,7 +107,10 @@ export function applyPatchesForApp(appPath: AppPath, reverse: boolean): void {
104107
})
105108
}
106109

107-
export function applyPatch(patchFilePath: string, reverse: boolean): boolean {
110+
export const applyPatch = (
111+
patchFilePath: string,
112+
reverse: boolean,
113+
): boolean => {
108114
const patchFileContents = fs.readFileSync(patchFilePath).toString()
109115
try {
110116
const result = patch(patchFileContents, {

β€Žsrc/patch/apply.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type Effect =
2828
noNewlineAtEndOfFile: boolean
2929
}
3030

31-
export function executeEffects(effects: Effect[]) {
31+
export const executeEffects = (effects: Effect[]) => {
3232
effects.forEach(eff => {
3333
switch (eff.type) {
3434
case "file deletion":
@@ -153,7 +153,7 @@ function applyPatch({ parts, path }: FilePatch): Effect {
153153
}
154154
}
155155

156-
export function applyPatchFile(patch: ParsedPatchFile): Effect[] {
156+
export const applyPatchFile = (patch: ParsedPatchFile): Effect[] => {
157157
const effects: Effect[] = []
158158

159159
for (const part of patch) {

β€Žsrc/patch/index.tsβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import { parsePatch } from "./parse"
22
import { applyPatchFile, Effect } from "./apply"
33
import { reversePatch } from "./reverse"
44

5-
export function patch(
5+
export const patch = (
66
patchFileContents: string,
77
{
88
reverse = false,
99
}: {
1010
reverse?: boolean
1111
} = {},
12-
): Effect[] {
13-
let patch = parsePatch(patchFileContents)
12+
): Effect[] => {
13+
let parsedPatch = parsePatch(patchFileContents)
1414

1515
if (reverse) {
16-
patch = reversePatch(patch)
16+
parsedPatch = reversePatch(parsedPatch)
1717
}
1818

19-
return applyPatchFile(patch)
19+
return applyPatchFile(parsedPatch)
2020
}

β€Žsrc/patch/parse.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface HunkHeader {
1010
}
1111
}
1212

13-
export function parseHunkHeaderLine(headerLine: string): HunkHeader {
13+
export const parseHunkHeaderLine = (headerLine: string): HunkHeader => {
1414
const match = headerLine
1515
.trim()
1616
.match(/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/)
@@ -383,6 +383,6 @@ class PatchParser {
383383
}
384384
}
385385

386-
export function parsePatch(patchFileContents: string): ParsedPatchFile {
386+
export const parsePatch = (patchFileContents: string): ParsedPatchFile => {
387387
return new PatchParser(patchFileContents.split(/\n/)).parse()
388388
}

β€Žsrc/patch/reverse.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function reverseHunks(hunks: PatchHunk[]): PatchHunk[] {
4242
return result
4343
}
4444

45-
export function reversePatch(patch: ParsedPatchFile): ParsedPatchFile {
45+
export const reversePatch = (patch: ParsedPatchFile): ParsedPatchFile => {
4646
return patch
4747
.map((part: PatchFilePart): PatchFilePart => {
4848
switch (part.type) {

β€Žsrc/patchFs.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function _getPatchFiles(
1919
return acc
2020
}
2121

22-
export function getPatchFiles(patchesDir: string) {
22+
export const getPatchFiles = (patchesDir: string) => {
2323
return _getPatchFiles(patchesDir).filter(filename =>
2424
filename.match(/^.+(:|\+).+\.patch$/),
2525
)

0 commit comments

Comments
Β (0)