summaryrefslogtreecommitdiff
path: root/std/testing/diff.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-29 04:03:49 +1100
committerGitHub <noreply@github.com>2020-03-28 13:03:49 -0400
commitbced52505f32d6cca4f944bb610a8a26767908a8 (patch)
treeda49a5df4b7bd6f8306248069228cd6bd0db1303 /std/testing/diff.ts
parent1397b8e0e7c85762e19d88fde103342bfa563360 (diff)
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/testing/diff.ts')
-rw-r--r--std/testing/diff.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/std/testing/diff.ts b/std/testing/diff.ts
index 5cedb402a..97baa089f 100644
--- a/std/testing/diff.ts
+++ b/std/testing/diff.ts
@@ -7,7 +7,7 @@ interface FarthestPoint {
export enum DiffType {
removed = "removed",
common = "common",
- added = "added"
+ added = "added",
}
export interface DiffResult<T> {
@@ -60,12 +60,12 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...A.map(
(a): DiffResult<typeof a> => ({
type: swapped ? DiffType.added : DiffType.removed,
- value: a
+ value: a,
})
),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}
const offset = N;
@@ -107,13 +107,13 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
if (type === REMOVED) {
result.unshift({
type: swapped ? DiffType.removed : DiffType.added,
- value: B[b]
+ value: B[b],
});
b -= 1;
} else if (type === ADDED) {
result.unshift({
type: swapped ? DiffType.added : DiffType.removed,
- value: A[a]
+ value: A[a],
});
a -= 1;
} else {
@@ -133,8 +133,9 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
k: number,
M: number
): FarthestPoint {
- if (slide && slide.y === -1 && down && down.y === -1)
+ if (slide && slide.y === -1 && down && down.y === -1) {
return { y: 0, id: 0 };
+ }
if (
(down && down.y === -1) ||
k === M ||
@@ -215,6 +216,6 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...backTrace(A, B, fp[delta + offset], swapped),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}