1 | /**
|
2 | * Find all strings in the first argument that are not in the second.
|
3 | */
|
4 | export declare function difference(a: string[], b: string[]): string[];
|
5 | /**
|
6 | * Compare two objects deeply to see if they are equal.
|
7 | */
|
8 | export declare function isEqual(a: any, b: any): boolean;
|
9 | /**
|
10 | * A polyfill for Object.assign
|
11 | *
|
12 | * This is from code that Typescript 2.4 generates for a polyfill.
|
13 | */
|
14 | export declare let assign: any;
|
15 | /**
|
16 | * Generate a UUID
|
17 | *
|
18 | * http://www.ietf.org/rfc/rfc4122.txt
|
19 | */
|
20 | export declare function uuid(): string;
|
21 | /**
|
22 | * Wrappable Error class
|
23 | *
|
24 | * The Error class doesn't actually act on `this`. Instead it always
|
25 | * returns a new instance of Error. Here we capture that instance so we
|
26 | * can apply it's properties to `this`.
|
27 | */
|
28 | export declare class WrappedError extends Error {
|
29 | constructor(message: string, error: any);
|
30 | error_stack: any[];
|
31 | }
|
32 | /**
|
33 | * A simple dictionary type.
|
34 | */
|
35 | export declare type Dict<T> = {
|
36 | [keys: string]: T;
|
37 | };
|
38 | /**
|
39 | * Resolve a promiseful dictionary.
|
40 | * Returns a single Promise.
|
41 | */
|
42 | export declare function resolvePromisesDict<V>(d: Dict<PromiseLike<V>>): Promise<Dict<V>>;
|
43 | /**
|
44 | * Creates a wrappable Promise rejection function.
|
45 | *
|
46 | * Creates a function that logs an error message before rethrowing
|
47 | * the original error that caused the promise to reject.
|
48 | */
|
49 | export declare function reject(message: string, log: boolean): (error: any) => never;
|
50 | /**
|
51 | * Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i]
|
52 | * where buffer_paths[i] is a list indicating where in the object buffer[i] should
|
53 | * be placed
|
54 | * Example: state = {a: 1, b: {}, c: [0, null]}
|
55 | * buffers = [array1, array2]
|
56 | * buffer_paths = [['b', 'data'], ['c', 1]]
|
57 | * Will lead to {a: 1, b: {data: array1}, c: [0, array2]}
|
58 | */
|
59 | export declare function put_buffers(state: any, buffer_paths: (string | number)[][], buffers: DataView[]): void;
|
60 | /**
|
61 | * The inverse of put_buffers, return an objects with the new state where all buffers(ArrayBuffer)
|
62 | * are removed. If a buffer is a member of an object, that object is cloned, and the key removed. If a buffer
|
63 | * is an element of an array, that array is cloned, and the element is set to null.
|
64 | * See put_buffers for the meaning of buffer_paths
|
65 | * Returns an object with the new state (.state) an array with paths to the buffers (.buffer_paths),
|
66 | * and the buffers associated to those paths (.buffers).
|
67 | */
|
68 | export declare function remove_buffers(state: any): {
|
69 | state: any;
|
70 | buffers: ArrayBuffer[];
|
71 | buffer_paths: (string | number)[][];
|
72 | };
|
73 | /**
|
74 | * Convert an ArrayBuffer to a hex string.
|
75 | */
|
76 | export declare function bufferToHex(buffer: ArrayBuffer): string;
|
77 | /**
|
78 | * Convert a hex string to an ArrayBuffer.
|
79 | */
|
80 | export declare function hexToBuffer(hex: string): ArrayBuffer;
|
81 | /**
|
82 | * Convert an ArrayBuffer to a base64 string.
|
83 | */
|
84 | export declare function bufferToBase64(buffer: ArrayBuffer): string;
|
85 | /**
|
86 | * Convert a base64 string to an ArrayBuffer.
|
87 | */
|
88 | export declare function base64ToBuffer(base64: string): ArrayBuffer;
|