1
0

change project structure to remove namespaces

This commit is contained in:
2024-05-11 16:46:47 +02:00
parent 727cdc3b2b
commit 486abefba6
17 changed files with 1201 additions and 1155 deletions

20
src/random/types.ts Normal file
View File

@@ -0,0 +1,20 @@
import { MaybeAsyncFunction } from "../types.js";
export type ElementPredicate<T = any> = (index: number, obj: T) => boolean;
export type ElementWeight<T = any> = (index: number, obj: T) => number;
export type RandomGenerator = () => number;
export interface RandomOptions<T = any> {
predicate?: ElementPredicate<T>;
weight?: ElementWeight<T>;
random?: RandomGenerator;
};
export type MaybeAsyncElementPredicate<T = any> = MaybeAsyncFunction<ElementPredicate<T>>;
export type MaybeAsyncElementWeight<T = any> = MaybeAsyncFunction<ElementWeight<T>>;
export interface AsyncRandomOptions<T = any> {
predicate?: MaybeAsyncElementPredicate<T>;
weight?: MaybeAsyncElementWeight<T>;
random?: RandomGenerator;
};