Skip to content

Commit 45601c8

Browse files
committed
naming fix
1 parent 79412e9 commit 45601c8

File tree

3 files changed

+1046
-0
lines changed

3 files changed

+1046
-0
lines changed

dist/linq4js.d.ts

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
declare namespace Linq4JS {
2+
class GeneratedEntity {
3+
_GeneratedId_: number;
4+
Id: number;
5+
}
6+
}
7+
declare namespace Linq4JS {
8+
class Helper {
9+
static ConvertStringFunction: (functionString: string) => any;
10+
static ConvertFunction: <T>(testFunction: any) => T;
11+
static OrderCompareFunction: <T>(valueSelector: (item: T) => any, a: T, b: T, invert: boolean) => number;
12+
}
13+
}
14+
interface Array<T> {
15+
Order: Array<Linq4JS.OrderEntry>;
16+
GroupValue: any;
17+
/**
18+
* Creates a copy of the array
19+
*/
20+
Clone(): Array<T>;
21+
/**
22+
* Gets the index of the first item found by a filter
23+
* @param filter A function (or function-string) that returns a boolean when matching element was found
24+
*/
25+
FindIndex(filter: ((item: T) => boolean) | string): number;
26+
/**
27+
* Gets the item with the index
28+
* @param index Item index
29+
*/
30+
Get(index: number): T;
31+
/**
32+
* Executes a method for each item in the array
33+
* @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops.
34+
*/
35+
ForEach(action: ((item: T) => boolean | any) | string): Array<T>;
36+
/**
37+
* Updates an object in the array
38+
* @param object The object to update
39+
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
40+
*/
41+
Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
42+
/**
43+
* Updates objects in the array
44+
* @param objects The array of objects to update
45+
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
46+
*/
47+
UpdateRange(objects: Array<T>, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
48+
/**
49+
* Removes an object from the array
50+
* @param object The object to remove
51+
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
52+
*/
53+
Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
54+
/**
55+
* Removes objects from the array
56+
* @param objects The array of objects to remove
57+
* @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array
58+
*/
59+
RemoveRange(objects: Array<T>, primaryKeySelector?: ((item: T) => any) | string): Array<T>;
60+
/**
61+
* Adds an object to the array
62+
* @param object The object to add
63+
* @param generateId Auto-generate a property to identify object in later processes
64+
*/
65+
Add(object: T, generateId?: boolean): Array<T>;
66+
/**
67+
* Adds objects to the array
68+
* @param objects The array of objects to add
69+
* @param generateId Auto-generate a property to identify objects in later processes
70+
*/
71+
AddRange(objects: Array<T>): Array<T>;
72+
/**
73+
* Inserts an entry at a specific position
74+
* @param object The object to insert
75+
* @param index The position to insert
76+
*/
77+
Insert(object: T, index: number): Array<T>;
78+
/**
79+
* Searches for all items in array that match the given filter
80+
* @param filter A function (or function-string) that returns a boolean when matching element was found
81+
*/
82+
Where(filter: ((item: T) => boolean) | string): Array<T>;
83+
/**
84+
* Takes items in a specific range
85+
* @param start The start position
86+
* @param length The number of elements to take
87+
*/
88+
Range(start: number, length: number): Array<T>;
89+
/**
90+
* Repeats an object in the array
91+
* @param object The object to repeat
92+
* @param count The count of repeats
93+
*/
94+
Repeat(object: T, count: number): Array<T>;
95+
/**
96+
* Returns the length of the array
97+
* @param filter If set the function returns count of elements matched by the condition
98+
*/
99+
Count(filter?: ((item: T) => boolean) | string): number;
100+
/**
101+
* Tests if all items in the array match the condition
102+
* @param filter A function (or function-string) that returns a boolean when matching element was found
103+
*/
104+
All(filter: ((item: T) => boolean) | string): boolean;
105+
/**
106+
* Tests if any item is in the array
107+
* @param filter If set the function tests if any item in the array matches the condition
108+
*/
109+
Any(filter?: ((item: T) => boolean) | string): boolean;
110+
/**
111+
* Returns the first item of the array - Throws an exception if no item was found
112+
* @param filter If set the function returns the first item that matches the filter
113+
*/
114+
First(filter?: ((item: T) => boolean) | string): T;
115+
/**
116+
* Returns the first item of the array - returns `null` if no suitable item was found
117+
* @param filter If set the function returns the first item that matches the filter
118+
*/
119+
FirstOrDefault(filter?: ((item: T) => boolean) | string): T;
120+
/**
121+
* Returns the last item of the array - Throws an exception if no item was found
122+
* @param filter If set the function returns the last item that matches the filter
123+
*/
124+
Last(filter?: ((item: T) => boolean) | string): T;
125+
/**
126+
* Returns the last item of the array - returns `null` if no suitable item was found
127+
* @param filter If set the function returns the last item that matches the filter
128+
*/
129+
LastOrDefault(filter?: ((item: T) => boolean) | string): T;
130+
/**
131+
* Select the properties for a new array
132+
* @param selector A function (or a function-string) that returns a new object
133+
*/
134+
Select(selector: ((item: T) => any) | string): any[];
135+
/**
136+
* Limits the number of entries taken
137+
* @param count The count of elements taken
138+
*/
139+
Take(count: number): Array<T>;
140+
/**
141+
* Takes entries as long as a condition is true
142+
* @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken
143+
* @param initial A initial-function (or function-string) that gets executed once at the start of the loop
144+
* @param after A function that gets executed after every element-iteration after the condition-function was evaluated
145+
*/
146+
TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array<T>;
147+
/**
148+
* Skips entries
149+
* @param count The count of elements skipped
150+
*/
151+
Skip(count: number): Array<T>;
152+
/**
153+
* Orders array by property or value in ascending direction
154+
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
155+
*/
156+
OrderBy(valueSelector: ((item: T) => any) | string): Array<T>;
157+
/**
158+
* Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending
159+
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
160+
*/
161+
ThenBy(valueSelector: ((item: T) => any) | string): Array<T>;
162+
/**
163+
* Orders array by property or value in descending direction
164+
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
165+
*/
166+
OrderByDescending(valueSelector: ((item: T) => any) | string): Array<T>;
167+
/**
168+
* Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending
169+
* @param valueSelector The selector-function (or function-string) that selects the property for sorting
170+
*/
171+
ThenByDescending(valueSelector: ((item: T) => any) | string): Array<T>;
172+
/**
173+
* Returns the smallest element in array
174+
* @param valueSelector The selector-function (or function-string) that selects the property for comparison
175+
*/
176+
Min(valueSelector?: ((item: T) => any) | string): T;
177+
/**
178+
* Returns the greates element in array
179+
* @param valueSelector The selector-function (or function-string) that selects the property for comparison
180+
*/
181+
Max(valueSelector?: ((item: T) => any) | string): T;
182+
/**
183+
* Groups array by property
184+
* @param selector The selector-function (or function-string) that selects the property for grouping
185+
*/
186+
GroupBy(selector: ((item: T) => any) | string): Array<Array<T>>;
187+
/**
188+
* Moves an item from one index to another
189+
* @param oldIndex The current position of the item
190+
* @param newIndex The new position of the item
191+
*/
192+
Move(oldIndex: number, newIndex: number): Array<T>;
193+
/**
194+
* Makes all values unique
195+
* @param valueSelector A selector-function (or function-string) to select property for comparison and distinction
196+
*/
197+
Distinct(valueSelector?: ((item: T) => any) | string): Array<T>;
198+
/**
199+
* Tests if array contains specific object
200+
* @param object The object to test for
201+
*/
202+
Contains(object: T): boolean;
203+
/**
204+
* Combines two arrays
205+
* @param array The array to combine
206+
*/
207+
Concat(array: Array<T>): Array<T>;
208+
/**
209+
* Combines two arrays but only applies values that are in both arrays
210+
* @param array The array to combine
211+
*/
212+
Intersect(array: Array<T>): Array<T>;
213+
/**
214+
* Joins the entries by a given char
215+
* @param character The character for joining
216+
* @param selector A selector-function (or function-string) to select property for joining
217+
*/
218+
Join(character: string, selector?: ((item: T) => any) | string): string;
219+
/**
220+
* Combines the entries using a custom function
221+
* @param method A function (or function-string) for aggregation
222+
* @param startVal The value to start aggregation
223+
*/
224+
Aggregate(method: ((result: any, item: T) => any) | string, startVal?: any): string;
225+
/**
226+
* Reverses the array
227+
*/
228+
Reverse(): Array<T>;
229+
/**
230+
* Computes the average of the elements
231+
* @param selector A selector-function (or function-string) to select property for average computing
232+
* @param filter If set the function computes the average of elements that match the filter
233+
*/
234+
Average(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number;
235+
/**
236+
* Computes the sum of the elements
237+
* @param selector A selector-function (or function-string) to select property for adding
238+
* @param filter If set the function computes the sum of elements that match the filter
239+
*/
240+
Sum(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number;
241+
/**
242+
* Compares to sequences of objects
243+
* @param array The array to compare
244+
*/
245+
SequenceEqual(array: Array<T>): boolean;
246+
/**
247+
* Combines the entries of two arrays using a custom function
248+
* @param array The array to combine
249+
* @param result The function (or function-string) to combine elements
250+
*/
251+
Zip<T, X>(array: Array<X>, result: ((first: T, second: X) => any) | string): Array<any>;
252+
/**
253+
* Combines two arrays without duplicates
254+
* @param array The array to combine
255+
*/
256+
Union(array: Array<T>): Array<T>;
257+
/**
258+
* Converts the array to a dictionary
259+
* @param keySelector The selector-function (or function-string) to select property for key
260+
* @param valueSelector A selector-function (or function-string) to select property for value
261+
*/
262+
ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any;
263+
}
264+
declare module "linq4js" {
265+
export = Linq4JS;
266+
}
267+
declare namespace Linq4JS {
268+
class OrderEntry {
269+
Direction: OrderDirection;
270+
ValueSelector: (item: any) => any;
271+
constructor(_direction: OrderDirection, _valueSelector: (item: any) => any);
272+
}
273+
enum OrderDirection {
274+
Ascending = 0,
275+
Descending = 1,
276+
}
277+
}

0 commit comments

Comments
 (0)