UNPKG

3.61 kBTypeScriptView Raw
1export declare var Map: MapConstructor;
2export declare var Set: SetConstructor;
3export declare class MapWrapper {
4 static clone<K, V>(m: Map<K, V>): Map<K, V>;
5 static createFromStringMap<T>(stringMap: {
6 [key: string]: T;
7 }): Map<string, T>;
8 static toStringMap<T>(m: Map<string, T>): {
9 [key: string]: T;
10 };
11 static createFromPairs(pairs: any[]): Map<any, any>;
12 static clearValues(m: Map<any, any>): void;
13 static iterable<T>(m: T): T;
14 static keys<K>(m: Map<K, any>): K[];
15 static values<V>(m: Map<any, V>): V[];
16}
17/**
18 * Wraps Javascript Objects
19 */
20export declare class StringMapWrapper {
21 static create(): {
22 [k: string]: any;
23 };
24 static contains(map: {
25 [key: string]: any;
26 }, key: string): boolean;
27 static get<V>(map: {
28 [key: string]: V;
29 }, key: string): V;
30 static set<V>(map: {
31 [key: string]: V;
32 }, key: string, value: V): void;
33 static keys(map: {
34 [key: string]: any;
35 }): string[];
36 static values<T>(map: {
37 [key: string]: T;
38 }): T[];
39 static isEmpty(map: {
40 [key: string]: any;
41 }): boolean;
42 static delete(map: {
43 [key: string]: any;
44 }, key: string): void;
45 static forEach<K, V>(map: {
46 [key: string]: V;
47 }, callback: Function): void;
48 static merge<V>(m1: {
49 [key: string]: V;
50 }, m2: {
51 [key: string]: V;
52 }): {
53 [key: string]: V;
54 };
55 static equals<V>(m1: {
56 [key: string]: V;
57 }, m2: {
58 [key: string]: V;
59 }): boolean;
60}
61/**
62 * A boolean-valued function over a value, possibly including context information
63 * regarding that value's position in an array.
64 */
65export interface Predicate<T> {
66 (value: T, index?: number, array?: T[]): boolean;
67}
68export declare class ListWrapper {
69 static createFixedSize(size: number): any[];
70 static createGrowableSize(size: number): any[];
71 static clone<T>(array: T[]): T[];
72 static forEachWithIndex<T>(array: T[], fn: (t: T, n: number) => void): void;
73 static first<T>(array: T[]): T;
74 static last<T>(array: T[]): T;
75 static indexOf<T>(array: T[], value: T, startIndex?: number): number;
76 static contains<T>(list: T[], el: T): boolean;
77 static reversed<T>(array: T[]): T[];
78 static concat(a: any[], b: any[]): any[];
79 static insert<T>(list: T[], index: number, value: T): void;
80 static removeAt<T>(list: T[], index: number): T;
81 static removeAll<T>(list: T[], items: T[]): void;
82 static remove<T>(list: T[], el: T): boolean;
83 static clear(list: any[]): void;
84 static isEmpty(list: any[]): boolean;
85 static fill(list: any[], value: any, start?: number, end?: number): void;
86 static equals(a: any[], b: any[]): boolean;
87 static slice<T>(l: T[], from?: number, to?: number): T[];
88 static splice<T>(l: T[], from: number, length: number): T[];
89 static sort<T>(l: T[], compareFn?: (a: T, b: T) => number): void;
90 static toString<T>(l: T[]): string;
91 static toJSON<T>(l: T[]): string;
92 static maximum<T>(list: T[], predicate: (t: T) => number): T;
93 static flatten<T>(list: Array<T | T[]>): T[];
94 static addAll<T>(list: Array<T>, source: Array<T>): void;
95}
96export declare function isListLikeIterable(obj: any): boolean;
97export declare function areIterablesEqual(a: any, b: any, comparator: Function): boolean;
98export declare function iterateListLike(obj: any, fn: Function): void;
99export declare class SetWrapper {
100 static createFromList<T>(lst: T[]): Set<T>;
101 static has<T>(s: Set<T>, key: T): boolean;
102 static delete<K>(m: Set<K>, k: K): void;
103}
104
\No newline at end of file