原本是form作为变量名,但是指代的是from的key,语义不清晰
Signed-off-by: Catchiz <1375535806@qq.com>
This commit is contained in:
parent
f6defe8180
commit
bd84a49492
|
@ -109,12 +109,12 @@ export function stripBasename(path: string, prefix: string): string {
|
||||||
export function createMemoryRecord<T, S>(initVal: S, fn: (arg: S) => T) {
|
export function createMemoryRecord<T, S>(initVal: S, fn: (arg: S) => T) {
|
||||||
let visitedRecord: T[] = [fn(initVal)];
|
let visitedRecord: T[] = [fn(initVal)];
|
||||||
|
|
||||||
function getDelta(to: S, form: S): number {
|
function getDelta(toKey: S, fromKey: S): number {
|
||||||
let toIdx = visitedRecord.lastIndexOf(fn(to));
|
let toIdx = visitedRecord.lastIndexOf(fn(toKey));
|
||||||
if (toIdx === -1) {
|
if (toIdx === -1) {
|
||||||
toIdx = 0;
|
toIdx = 0;
|
||||||
}
|
}
|
||||||
let fromIdx = visitedRecord.lastIndexOf(fn(form));
|
let fromIdx = visitedRecord.lastIndexOf(fn(fromKey));
|
||||||
if (fromIdx === -1) {
|
if (fromIdx === -1) {
|
||||||
fromIdx = 0;
|
fromIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue