原本是form作为变量名,但是指代的是from的key,语义不清晰

Signed-off-by: Catchiz <1375535806@qq.com>
This commit is contained in:
Catchiz 2023-10-27 07:38:12 +00:00 committed by Gitee
parent f6defe8180
commit bd84a49492
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 3 deletions

View File

@ -109,12 +109,12 @@ export function stripBasename(path: string, prefix: string): string {
export function createMemoryRecord<T, S>(initVal: S, fn: (arg: S) => T) {
let visitedRecord: T[] = [fn(initVal)];
function getDelta(to: S, form: S): number {
let toIdx = visitedRecord.lastIndexOf(fn(to));
function getDelta(toKey: S, fromKey: S): number {
let toIdx = visitedRecord.lastIndexOf(fn(toKey));
if (toIdx === -1) {
toIdx = 0;
}
let fromIdx = visitedRecord.lastIndexOf(fn(form));
let fromIdx = visitedRecord.lastIndexOf(fn(fromKey));
if (fromIdx === -1) {
fromIdx = 0;
}