export declare type Omit = Pick>; export declare const ONE_SECOND = 1000; export declare const ONE_MINUTE: number; export declare const ONE_HOUR: number; export declare const ONE_KILO_BYTE = 1024; export declare enum DOM_EVENT { BEFORE_UNLOAD = "beforeunload", CLICK = "click", KEY_DOWN = "keydown", LOAD = "load", POP_STATE = "popstate", SCROLL = "scroll", TOUCH_START = "touchstart", VISIBILITY_CHANGE = "visibilitychange", DOM_CONTENT_LOADED = "DOMContentLoaded" } export declare enum ResourceKind { DOCUMENT = "document", XHR = "xhr", BEACON = "beacon", FETCH = "fetch", CSS = "css", JS = "js", IMAGE = "image", FONT = "font", MEDIA = "media", OTHER = "other" } export declare enum RequestType { FETCH = "fetch", XHR = "xhr" } export declare function throttle(fn: () => void, wait: number, options?: { leading?: boolean; trailing?: boolean; }): { throttled: () => void; cancel: () => void; }; /** * Performs a deep merge of objects and arrays * - arrays values are merged index by index * - objects are merged by keys * - values get replaced, unless undefined * * ⚠️ this method does not prevent infinite loops while merging circular references ⚠️ * */ export declare function deepMerge(destination: ContextValue, ...toMerge: ContextValue[]): ContextValue; export declare function combine(a: A, b: B, c: C): A & B & C; export declare function combine(a: A, b: B, c: C, d: D): A & B & C & D; interface Assignable { [key: string]: any; } export declare function assign(target: Assignable, ...toAssign: Assignable[]): void; /** * UUID v4 * from https://gist.github.com/jed/982883 */ export declare function generateUUID(placeholder?: string): string; /** * Return true if the draw is successful * @param threshold between 0 and 100 */ export declare function performDraw(threshold: number): boolean; export declare function round(num: number, decimals: 0 | 1 | 2 | 3): number; export declare function msToNs(duration: number | T): number | T; export interface Context { [x: string]: ContextValue; } export declare type ContextValue = string | number | boolean | Context | ContextArray | undefined; export interface ContextArray extends Array { } export declare function withSnakeCaseKeys(candidate: Context): Context; export declare function deepSnakeCase(candidate: ContextValue): ContextValue; export declare function toSnakeCase(word: string): string; export declare function noop(): void; /** * Custom implementation of JSON.stringify that ignores value.toJSON. * We need to do that because some sites badly override toJSON on certain objects. * Note this still supposes that JSON.stringify is correct... */ export declare function jsonStringify(value: unknown, replacer?: Array, space?: string | number): string | undefined; export declare function includes(candidate: string, search: string): boolean; export declare function includes(candidate: T[], search: T): boolean; export declare function find(array: T[], predicate: (item: T, index: number, array: T[]) => unknown): T | undefined; export declare function isPercentage(value: unknown): boolean; export declare function isNumber(value: unknown): value is number; /** * Get the time since the navigation was started. * * Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual * time on which the navigation has started: it may be much farther in the past, at least in Firefox 71. * Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926 */ export declare function getRelativeTime(timestamp: number): number; export declare function getTimestamp(relativeTime: number): number; export declare function getNavigationStart(): number; export declare function objectValues(object: { [key: string]: unknown; }): unknown[]; export declare function objectEntries(object: { [key: string]: unknown; }): unknown[][]; export declare function isEmptyObject(object: object): boolean; /** * inspired by https://mathiasbynens.be/notes/globalthis */ export declare function getGlobalObject(): T; export declare function getLocationOrigin(): string; /** * IE fallback * https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin */ export declare function getLinkElementOrigin(element: Location | HTMLAnchorElement | URL): string; export declare function findCommaSeparatedValue(rawString: string, name: string): string | undefined; export {};