Comparing version 0.6.1 to 0.7.0
import { type MaybePromise } from "./iterate.js"; | ||
export declare function filter<T, S extends T>(arr: MaybePromise<T>[], predicate: (t: T) => t is S): Promise<Array<S>>; | ||
type NotBoolean<S> = S extends boolean ? never : S; | ||
export declare function filter<T, S>(arr: MaybePromise<T>[], predicate: (t: T) => NotBoolean<S> | undefined): Promise<Array<NotBoolean<S>>>; | ||
export declare function filter<T>(arr: MaybePromise<T>[], predicate: (t: T) => boolean): Promise<Array<T>>; | ||
export {}; |
import { type MaybePromise } from "./iterate.js"; | ||
export declare function find<T, S extends T>(arr: MaybePromise<T>[], predicate: (t: T) => t is S): Promise<S | undefined>; | ||
type NotBoolean<S> = S extends boolean ? never : S; | ||
/** | ||
* find element that matches a predicate | ||
* | ||
* Can alter return type by returning a non-boolean value | ||
* @example | ||
* const foo: "foo" = find(arr, (item) => item === 'foo' ? item : foo) | ||
*/ | ||
export declare function find<T, S>(arr: MaybePromise<T>[], predicate: (t: T) => NotBoolean<S> | undefined): Promise<NotBoolean<S> | undefined>; | ||
export declare function find<T>(arr: MaybePromise<T>[], predicate: (t: T) => boolean): Promise<T | undefined>; | ||
export {}; |
{ | ||
"name": "emmi", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
10121
302