Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(internal): cleanup _internals #4702

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions internal/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,3 @@ export function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
),
];
}

export const _internals = { diff };
6 changes: 3 additions & 3 deletions internal/diff_str.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { DiffResult } from "./_types.ts";
import { _internals } from "./diff.ts";
import { diff } from "./diff.ts";

/**
* Renders the differences between the actual and expected strings
Expand Down Expand Up @@ -93,7 +93,7 @@ export function diffstr(A: string, B: string): DiffResult<string>[] {
}

// Compute multi-line diff
const diffResult = _internals.diff(
const diffResult = diff(
tokenize(`${unescape(A)}\n`),
tokenize(`${unescape(B)}\n`),
);
Expand Down Expand Up @@ -124,7 +124,7 @@ export function diffstr(A: string, B: string): DiffResult<string>[] {
tokenize(b?.value ?? "", { wordDiff: true }),
] as [string[], string[]];
if (hasMoreRemovedLines) tokenized.reverse();
tokens = _internals.diff(tokenized[0], tokenized[1]);
tokens = diff(tokenized[0], tokenized[1]);
if (
tokens.some(({ type, value }) =>
type === "common" && value.trim().length
Expand Down