refactor: code cleanup, formatting updates, improved workspace handling, checkpoints feature
Add instructions Fix completion Refactor Rename reset to restore add haschanges flag Remove log Better error handling Better error handling Fix wording Fix Fix Fix Comment Add hash for only latest tool Prepare for release Fix Fix delete Format fix
This commit is contained in:
1 parent
a7e9d47375
commit
9de7253998
113 files changed
+7141
-1684
No files matched your search
+8
-2
@@ -6,7 +6,10 @@
|
||||
* order, until it finds one where predicate returns true. If such an element is found,
|
||||
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||||
*/
|
||||
export function findLastIndex<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): number {
|
||||
export function findLastIndex<T>(
|
||||
array: Array<T>,
|
||||
predicate: (value: T, index: number, obj: T[]) => boolean,
|
||||
): number {
|
||||
let l = array.length
|
||||
while (l--) {
|
||||
if (predicate(array[l], l, array)) {
|
||||
@@ -16,7 +19,10 @@ export function findLastIndex<T>(array: Array<T>, predicate: (value: T, index: n
|
||||
return -1
|
||||
}
|
||||
|
||||
export function findLast<T>(array: Array<T>, predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined {
|
||||
export function findLast<T>(
|
||||
array: Array<T>,
|
||||
predicate: (value: T, index: number, obj: T[]) => boolean,
|
||||
): T | undefined {
|
||||
const index = findLastIndex(array, predicate)
|
||||
return index === -1 ? undefined : array[index]
|
||||
}
|
||||
Reference in new issue
Block a user