You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
935 B
TypeScript
31 lines
935 B
TypeScript
/// <reference types="typescript" />
|
|
|
|
/**
|
|
* Poor-mans deepcopy() for most JS objects.
|
|
* As JSON.* is highly optimized, this surprisingly is quite fast.
|
|
*/
|
|
export function clone<T> (x: T): T
|
|
|
|
/**
|
|
* Parses a query string into KV-pairs
|
|
*/
|
|
export function fromQueryString (query: string): any
|
|
|
|
/**
|
|
* URL-encodes the object as query string key value pairs, excluding the leading `?`.
|
|
* Applies some string conversion using stringify() first.
|
|
*/
|
|
export function toQueryString (params: any): string
|
|
|
|
/** * Returns a promise that timeouts for the specified duration. */
|
|
export function wait (milliseconds: number): Promise<void>
|
|
|
|
/**
|
|
* Rounds `val` to `decimals` precision.
|
|
* Differs from Number.toFixed() in that it returns a number, and does not apply padding of zeros
|
|
*/
|
|
export function round (val: number, decimals?: number): number
|
|
|
|
/** improved toString() for Date & Object types */
|
|
export function stringify (v: any): string
|