refactor
This commit is contained in:
@@ -54,8 +54,7 @@ export function defaultArrayComparer<T>(a: T, b: T) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const aStr = a === null ? "null" : a.toString();
|
||||
const bStr = b === null ? "null" : b.toString();
|
||||
const aStr = `${a}`, bStr = `${b}`;
|
||||
|
||||
return aStr > bStr ? 1 : aStr < bStr ? -1 : 0;
|
||||
}
|
||||
@@ -81,7 +80,7 @@ export function* asGenerator<T>(iterator: Iterator<T>) {
|
||||
const next = iterator.next();
|
||||
|
||||
if (next.done) {
|
||||
break;
|
||||
return next.value;
|
||||
}
|
||||
|
||||
yield next.value;
|
||||
@@ -93,7 +92,7 @@ export async function* asAsyncGenerator<T>(iterator: MaybeAsyncIterator<T>) {
|
||||
const next = await iterator.next();
|
||||
|
||||
if (next.done) {
|
||||
break;
|
||||
return next.value;
|
||||
}
|
||||
|
||||
yield next.value;
|
||||
|
||||
Reference in New Issue
Block a user