@@ -10,24 +10,14 @@ var __extends = (this && this.__extends) || (function () {
10
10
} ;
11
11
} ) ( ) ;
12
12
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
13
- var List = /** @class */ ( function ( _super ) {
13
+ var List = ( function ( _super ) {
14
14
__extends ( List , _super ) ;
15
- /**
16
- * instantiates a list either with, or with out Array or List
17
- * var fruits = new List<Fruit>(favoriteFruits);
18
- * var fruits = new List<Fruit>();
19
- * @param array can be a list, an array, or null.
20
- */
21
15
function List ( array ) {
22
16
var _this = _super . call ( this ) || this ;
23
17
if ( array )
24
18
_this . AddRange ( array ) ;
25
19
return _this ;
26
20
}
27
- /**
28
- * Adds passed item to list.
29
- * @param item element to add
30
- */
31
21
List . prototype . Add = function ( item ) {
32
22
try {
33
23
this . _array . push ( item ) ;
@@ -37,11 +27,6 @@ var List = /** @class */ (function (_super) {
37
27
return false ;
38
28
}
39
29
} ;
40
- /**
41
- * Adds all passed elements to list, elements can be either an Array<T>, a List<T> or even multiple elements e.g.
42
- * fruits.AddRange(["apple", "banana", "lemon"]); fruits.AddRange(fruits2); fruits.AddRange("apple", "banana", "lemon");
43
- * @param args either Array<T>, List<T> or multiple elements,
44
- */
45
30
List . prototype . AddRange = function ( ) {
46
31
var args = [ ] ;
47
32
for ( var _i = 0 ; _i < arguments . length ; _i ++ ) {
@@ -63,11 +48,6 @@ var List = /** @class */ (function (_super) {
63
48
return false ;
64
49
}
65
50
} ;
66
- /**
67
- * Checks if list contains any elements. Delegate available. fruits.Any(x => x.Color === Color.Yellow) // e.g. 2
68
- * @param delegate
69
- * @param args
70
- */
71
51
List . prototype . Any = function ( delegate , args ) {
72
52
if ( delegate === void 0 ) { delegate = null ; }
73
53
try {
@@ -89,9 +69,6 @@ var List = /** @class */ (function (_super) {
89
69
return false ;
90
70
}
91
71
} ;
92
- /**
93
- * Removes all elements from list.
94
- */
95
72
List . prototype . Clear = function ( ) {
96
73
try {
97
74
for ( var i = this . _array . length ; i >= 0 ; i -- )
@@ -102,10 +79,6 @@ var List = /** @class */ (function (_super) {
102
79
return false ;
103
80
}
104
81
} ;
105
- /**
106
- * Returns true if list contains passed element.
107
- * @param item
108
- */
109
82
List . prototype . Contains = function ( item ) {
110
83
try {
111
84
return this . _array . indexOf ( item ) > - 1 ;
@@ -114,11 +87,6 @@ var List = /** @class */ (function (_super) {
114
87
return false ;
115
88
}
116
89
} ;
117
- /**
118
- * Returns listcount. Delegate available. fruits.Where(x => x.Color === Color.Yellow) // e.g. 2
119
- * @param delegate boolean to compare by delegate
120
- * @param args
121
- */
122
90
List . prototype . Count = function ( delegate , args ) {
123
91
if ( delegate === void 0 ) { delegate = null ; }
124
92
try {
@@ -141,11 +109,6 @@ var List = /** @class */ (function (_super) {
141
109
return 0 ;
142
110
}
143
111
} ;
144
- /**
145
- * Summarizes numbers within a list, ignoring invalid values, and converts strings if possible
146
- * @param delegate must be a number
147
- * @param args
148
- */
149
112
List . prototype . Sum = function ( delegate , args ) {
150
113
if ( delegate === void 0 ) { delegate = null ; }
151
114
try {
@@ -166,12 +129,6 @@ var List = /** @class */ (function (_super) {
166
129
throw new Error ( ex ) ;
167
130
}
168
131
} ;
169
- /**
170
- * Returns new list removes duplicates and select items from delegate if set.
171
- * Works on complex objects only, if elements inside are equal.
172
- * @param delegate distinct values to return.
173
- * @param args
174
- */
175
132
List . prototype . Distinct = function ( delegate , args ) {
176
133
if ( delegate === void 0 ) { delegate = null ; }
177
134
try {
@@ -192,11 +149,6 @@ var List = /** @class */ (function (_super) {
192
149
return new List ( ) ;
193
150
}
194
151
} ;
195
- /**
196
- * Compares two lists
197
- * @param list List to compare with
198
- * @param comparePosition default true, if false, equality will not be checked by position.
199
- */
200
152
List . prototype . Equals = function ( list , comparePosition ) {
201
153
if ( comparePosition === void 0 ) { comparePosition = true ; }
202
154
try {
@@ -206,9 +158,6 @@ var List = /** @class */ (function (_super) {
206
158
return false ;
207
159
}
208
160
} ;
209
- /**
210
- * Returns first element of list.
211
- */
212
161
List . prototype . First = function ( ) {
213
162
try {
214
163
return this . _array . First ( ) ;
@@ -217,10 +166,6 @@ var List = /** @class */ (function (_super) {
217
166
return null ;
218
167
}
219
168
} ;
220
- /**
221
- * Returns element at index
222
- * @param index
223
- */
224
169
List . prototype . Get = function ( index ) {
225
170
try {
226
171
return this . _array [ index ] ;
@@ -229,10 +174,6 @@ var List = /** @class */ (function (_super) {
229
174
return undefined ;
230
175
}
231
176
} ;
232
- /**
233
- * Returns index of passed element in list.
234
- * @param item
235
- */
236
177
List . prototype . IndexOf = function ( item ) {
237
178
try {
238
179
return this . _array . indexOf ( item ) ;
@@ -241,9 +182,6 @@ var List = /** @class */ (function (_super) {
241
182
return - 1 ;
242
183
}
243
184
} ;
244
- /**
245
- * Returns last element of list.
246
- */
247
185
List . prototype . Last = function ( ) {
248
186
try {
249
187
return this . _array . Last ( ) ;
@@ -252,10 +190,6 @@ var List = /** @class */ (function (_super) {
252
190
return null ;
253
191
}
254
192
} ;
255
- /**
256
- * Removes passed item from list
257
- * @param item Item to remove
258
- */
259
193
List . prototype . Remove = function ( item ) {
260
194
try {
261
195
var expectedLength = this . _array . length - 1 ;
@@ -267,10 +201,6 @@ var List = /** @class */ (function (_super) {
267
201
return false ;
268
202
}
269
203
} ;
270
- /**
271
- * Removes item at passed index.
272
- * @param index
273
- */
274
204
List . prototype . RemoveAt = function ( index ) {
275
205
try {
276
206
this . _array . splice ( index , 1 ) ;
@@ -280,11 +210,6 @@ var List = /** @class */ (function (_super) {
280
210
return false ;
281
211
}
282
212
} ;
283
- /**
284
- * Returns new list with by delegate selected value.
285
- * @param delegate
286
- * @param args
287
- */
288
213
List . prototype . Select = function ( delegate , args ) {
289
214
var list = new Array ( ) ;
290
215
try {
@@ -302,9 +227,6 @@ var List = /** @class */ (function (_super) {
302
227
return list . ToList ( ) ;
303
228
}
304
229
} ;
305
- /**
306
- * Converts List<T> to Array. Needed for serialization e.g. with ajax calls.
307
- */
308
230
List . prototype . ToArray = function ( ) {
309
231
try {
310
232
var array = new Array ( ) ;
@@ -316,11 +238,6 @@ var List = /** @class */ (function (_super) {
316
238
return null ;
317
239
}
318
240
} ;
319
- /**
320
- * Returns list by delegate fruits.Where(x => x.Color === Color.Red);
321
- * @param delegate
322
- * @param args
323
- */
324
241
List . prototype . Where = function ( delegate , args ) {
325
242
try {
326
243
var list = new Array ( ) ;
@@ -339,11 +256,6 @@ var List = /** @class */ (function (_super) {
339
256
return new List ( ) ;
340
257
}
341
258
} ;
342
- /**
343
- * Creates list of numbers, within a specified range.
344
- * @param start where to start
345
- * @param count count of numbers to create
346
- */
347
259
List . Range = function ( start , count ) {
348
260
try {
349
261
if ( count <= 0 )
@@ -357,9 +269,6 @@ var List = /** @class */ (function (_super) {
357
269
throw new Error ( ex ) ;
358
270
}
359
271
} ;
360
- /**
361
- * needed to call recursive
362
- */
363
272
List . prototype . equals = function ( list , array , comparePosition ) {
364
273
if ( ! list )
365
274
return false ;
@@ -368,14 +277,12 @@ var List = /** @class */ (function (_super) {
368
277
for ( var i = 0 , l = array . length ; i < l ; i ++ ) {
369
278
if ( array [ i ] instanceof Array && list [ i ] instanceof Array ) {
370
279
if ( ! this . equals ( list [ i ] , array [ i ] , comparePosition ) )
371
- // recursive call
372
280
return false ;
373
281
}
374
282
else if ( array [ i ] instanceof Object ) {
375
283
for ( var key in array [ i ] ) {
376
284
if ( array [ i ] . hasOwnProperty ( key ) && array [ i ] [ key ] instanceof Array ) {
377
285
if ( ! this . equals ( list [ i ] [ key ] , array [ i ] [ key ] , comparePosition ) )
378
- // recursive call
379
286
return false ;
380
287
}
381
288
}
@@ -511,4 +418,3 @@ Array.prototype.Where = function (delegate, args) {
511
418
List . prototype . _array = null ;
512
419
return returnValue ;
513
420
} ;
514
- //# sourceMappingURL=source.js.map
0 commit comments