import { t as Json } from "./types-BCtWYsuv.cjs"; //#region src/common/data/utils.d.ts /** * Call a create function if key does not yet exist on an object. Returns the found or created object. Example: * * ```js * function createRoom(room, rooms) { return new Room() } * ensureKey(rooms, room, createRoom).enter() * ``` */ declare function ensureKey(obj: Record, key: string, createFn: (key?: string, obj?: Record) => T): T; /** * Call a create function if key does not yet exist on an object. Returns the found or created object. Example: * * ```js * async function fetchItem(id, cache) { ... } * let data = await ensureKey(cache, id, fetchItem) * ``` */ declare function ensureKeyAsync(obj: Record, key: string, createFn: (key?: string, obj?: Record) => Promise): Promise; /** * Returns the size of an object, array, string or similar. For example: */ declare function size(obj: any): any; declare function first(array?: T[]): T | undefined; declare function last(array?: T[]): T | undefined; declare function empty(value: any): boolean; declare function cloneObject(obj: T): T; declare function cloneJsonObject(obj: T): T; /** * Cache result of a function. Same arguments have to always return the same result in order to get expected optimization! * * ``` * const square = memoize((value) => value * value)` * square(2) // == 2 * ``` */ declare function memoize(fn: (arg: In) => Out): (arg: In) => Out; declare function memoizeAsync>(fn: (...arg: In) => Out): (...arg: In) => Promise; /** Repeat `count` times. Starts with `0` */ declare function forTimes(count: number, fn: (i: number, count: number) => T): T[]; //#endregion export { ensureKeyAsync as a, last as c, size as d, ensureKey as i, memoize as l, cloneObject as n, first as o, empty as r, forTimes as s, cloneJsonObject as t, memoizeAsync as u }; //# sourceMappingURL=utils-DxFqV18u.d.cts.map