## API Report File for "@tldraw/utils" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts // @internal export function annotateError(error: unknown, annotations: Partial): void; // @internal (undocumented) export function areArraysShallowEqual(arr1: readonly T[], arr2: readonly T[]): boolean; // @internal (undocumented) export function areObjectsShallowEqual>(obj1: T, obj2: T): boolean; // @internal (undocumented) export const assert: (value: unknown, message?: string) => asserts value; // @internal (undocumented) export const assertExists: (value: T, message?: string | undefined) => NonNullable; // @internal export function clearLocalStorage(): void; // @internal export function clearSessionStorage(): void; // @internal (undocumented) export function compact(arr: T[]): NonNullable[]; // @public export function debounce(callback: (...args: T) => PromiseLike | U, wait: number): { (...args: T): Promise; cancel(): void; }; // @public export function dedupe(input: T[], equals?: (a: any, b: any) => boolean): T[]; // @internal export function deleteFromLocalStorage(key: string): void; // @internal export function deleteFromSessionStorage(key: string): void; // @public (undocumented) export type ErrorResult = { readonly error: E; readonly ok: false; }; // @internal (undocumented) export function exhaustiveSwitchError(value: never, property?: string): never; // @public (undocumented) export type Expand = T extends infer O ? { [K in keyof O]: O[K]; } : never; // @public export class FileHelpers { static blobToDataUrl(file: Blob): Promise; static blobToText(file: Blob): Promise; // (undocumented) static dataUrlToArrayBuffer(dataURL: string): Promise; } // @internal export function filterEntries(object: { [K in Key]: Value; }, predicate: (key: Key, value: Value) => boolean): { [K in Key]: Value; }; // @internal export function fpsThrottle(fn: () => void): () => void; // @internal (undocumented) export function getErrorAnnotations(error: Error): ErrorAnnotations; // @public export function getFirstFromIterable(set: Map | Set): T; // @internal export function getFromLocalStorage(key: string): null | string; // @internal export function getFromSessionStorage(key: string): null | string; // @public export function getHashForBuffer(buffer: ArrayBuffer): string; // @public export function getHashForObject(obj: any): string; // @public export function getHashForString(string: string): string; // @public export function getIndexAbove(below?: IndexKey | undefined): IndexKey; // @public export function getIndexBelow(above?: IndexKey | undefined): IndexKey; // @public export function getIndexBetween(below: IndexKey | undefined, above: IndexKey | undefined): IndexKey; // @public export function getIndices(n: number, start?: IndexKey): IndexKey[]; // @public export function getIndicesAbove(below: IndexKey | undefined, n: number): IndexKey[]; // @public export function getIndicesBelow(above: IndexKey | undefined, n: number): IndexKey[]; // @public export function getIndicesBetween(below: IndexKey | undefined, above: IndexKey | undefined, n: number): IndexKey[]; // @internal (undocumented) export function getOwnProperty(obj: Partial>, key: K): undefined | V; // @internal (undocumented) export function getOwnProperty(obj: object, key: string): unknown; // @internal (undocumented) export function hasOwnProperty(obj: object, key: string): boolean; // @public export type IndexKey = string & { __orderKey: true; }; // @public export function invLerp(a: number, b: number, t: number): number; // @public export function isDefined(value: T): value is typeof value extends undefined ? never : T; // @internal (undocumented) export const isNativeStructuredClone: boolean; // @public export function isNonNull(value: T): value is typeof value extends null ? never : T; // @public export function isNonNullish(value: T): value is typeof value extends undefined ? never : typeof value extends null ? never : T; // @public (undocumented) export type JsonArray = JsonValue[]; // @public (undocumented) export type JsonObject = { [key: string]: JsonValue | undefined; }; // @public (undocumented) export type JsonPrimitive = boolean | null | number | string; // @public (undocumented) export type JsonValue = JsonArray | JsonObject | JsonPrimitive; // @internal (undocumented) export function last(arr: readonly T[]): T | undefined; // @public export function lerp(a: number, b: number, t: number): number; // @public (undocumented) export function lns(str: string): string; // @internal export function mapObjectMapValues(object: { readonly [K in Key]: ValueBefore; }, mapper: (key: Key, value: ValueBefore) => ValueAfter): { [K in Key]: ValueAfter; }; // @internal (undocumented) export function measureAverageDuration(_target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor; // @internal (undocumented) export function measureCbDuration(name: string, cb: () => any): any; // @internal (undocumented) export function measureDuration(_target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor; // @public export class MediaHelpers { static getImageSize(blob: Blob): Promise<{ h: number; w: number; }>; static getVideoSize(blob: Blob): Promise<{ h: number; w: number; }>; static loadImage(src: string): Promise; static loadVideo(src: string): Promise; // (undocumented) static usingObjectURL(blob: Blob, fn: (url: string) => Promise): Promise; } // @internal (undocumented) export function minBy(arr: readonly T[], fn: (item: T) => number): T | undefined; // @public export function modulate(value: number, rangeA: number[], rangeB: number[], clamp?: boolean): number; // @internal export function noop(): void; // @internal export function objectMapEntries(object: { [K in Key]: Value; }): Array<[Key, Value]>; // @internal export function objectMapFromEntries(entries: ReadonlyArray): { [K in Key]: Value; }; // @internal export function objectMapKeys(object: { readonly [K in Key]: unknown; }): Array; // @internal export function objectMapValues(object: { [K in Key]: Value; }): Array; // @public (undocumented) export type OkResult = { readonly ok: true; readonly value: T; }; // @internal export function omitFromStackTrace, Return>(fn: (...args: Args) => Return): (...args: Args) => Return; // @internal export function partition(arr: T[], predicate: (item: T) => boolean): [T[], T[]]; // @public (undocumented) export class PerformanceTracker { // (undocumented) isStarted(): boolean; // (undocumented) recordFrame: () => void; // (undocumented) start(name: string): void; // (undocumented) stop(): void; } // @public (undocumented) export class PngHelpers { // (undocumented) static findChunk(view: DataView, type: string): { dataOffset: number; size: number; start: number; }; // (undocumented) static getChunkType(view: DataView, offset: number): string; // (undocumented) static isPng(view: DataView, offset: number): boolean; // (undocumented) static parsePhys(view: DataView, offset: number): { ppux: number; ppuy: number; unit: number; }; // (undocumented) static readChunks(view: DataView, offset?: number): Record; // (undocumented) static setPhysChunk(view: DataView, dpr?: number, options?: BlobPropertyBag): Blob; } // @internal (undocumented) export function promiseWithResolve(): Promise & { reject: (reason?: any) => void; resolve: (value: T) => void; }; // @public (undocumented) export type RecursivePartial = { [P in keyof T]?: RecursivePartial; }; // @internal (undocumented) type Required_2 = Expand & _Required>>; export { Required_2 as Required } // @public (undocumented) export type Result = ErrorResult | OkResult; // @public (undocumented) export const Result: { err(error: E): ErrorResult; ok(value: T): OkResult; }; // @public export function rng(seed?: string): () => number; // @public export function rotateArray(arr: T[], offset: number): T[]; // @internal export function setInLocalStorage(key: string, value: string): void; // @internal export function setInSessionStorage(key: string, value: string): void; // @public (undocumented) export function sortById(a: T, b: T): -1 | 1; // @public export function sortByIndex(a: T, b: T): -1 | 0 | 1; // @internal export const STRUCTURED_CLONE_OBJECT_PROTOTYPE: any; // @public const structuredClone_2: (i: T) => T; export { structuredClone_2 as structuredClone } // @public export function throttle any>(func: T, limit: number): (...args: Parameters) => ReturnType; // @internal export function throttleToNextFrame(fn: () => void): () => void; // @internal (undocumented) export function validateIndexKey(key: string): asserts key is IndexKey; // @internal (undocumented) export function warnDeprecatedGetter(name: string): void; // @public export class WeakCache { get

(item: P, cb: (item: P) => V): NonNullable; items: WeakMap; } // @public export const ZERO_INDEX_KEY: IndexKey; // (No @packageDocumentation comment for this package) ```