-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed some issues, applied improvements, added SelectMany
- Loading branch information
1 parent
ae2cf06
commit e48820f
Showing
72 changed files
with
2,118 additions
and
1,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Array.prototype.AddRange = function<T> (this: T[], objects: T[], generateId: boolean): T[] { | ||
Linq4JS.Helper.NonEnumerable("AddRange", function<T> (this: T[], objects: T[], generateId: boolean): T[] { | ||
let that: T[] = this; | ||
|
||
objects.ForEach(function (x: T) { | ||
that.Add(x, generateId); | ||
}); | ||
|
||
return that; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Array.prototype.All = function<T> (this: T[], filter: ((item: T) => boolean) | string): boolean { | ||
let that: T[] = this; | ||
|
||
return that.Count(filter) === that.Count(); | ||
}; | ||
Linq4JS.Helper.NonEnumerable("All", function<T> (this: T[], filter: ((item: T) => boolean) | string): boolean { | ||
return this.Count(filter) === this.Count(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Array.prototype.Any = function<T> (this: T[], filter?: ((item: T) => boolean) | string): boolean { | ||
let that: T[] = this; | ||
|
||
return that.Count(filter) > 0; | ||
}; | ||
Linq4JS.Helper.NonEnumerable("Any", function<T> (this: T[], filter?: ((item: T) => boolean) | string): boolean { | ||
return this.Count(filter) > 0; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
Array.prototype.Clone = function<T> (this: T[]): T[] { | ||
let that: T[] = this; | ||
|
||
Linq4JS.Helper.NonEnumerable("Clone", function<T> (this: T[]): T[] { | ||
let newArray: T[] = []; | ||
|
||
for (let obj of that) { | ||
for (let obj of this) { | ||
newArray.Add(obj); | ||
} | ||
|
||
return newArray; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Array.prototype.Concat = function<T> (this: T[], array: T[]): T[] { | ||
let that: T[] = this; | ||
that = that.concat(array); | ||
return that; | ||
}; | ||
Linq4JS.Helper.NonEnumerable("Concat", function<T> (this: T[], array: T[]): T[] { | ||
return this.concat(array); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
Array.prototype.Contains = function<T> (this: T[], object: T): boolean { | ||
let that: T[] = this; | ||
|
||
return that.Any(function(x){ | ||
Linq4JS.Helper.NonEnumerable("Contains", function<T> (this: T[], object: T): boolean { | ||
return this.Any(function(x){ | ||
return x === object; | ||
}); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
Array.prototype.Count = function <T>(this: T[], filter?: ((item: T) => boolean) | string): number { | ||
let that: T[] = this; | ||
|
||
Linq4JS.Helper.NonEnumerable("Count", function <T>(this: T[], filter?: ((item: T) => boolean) | string): number { | ||
if (filter != null) { | ||
return that.Where(filter).length; | ||
return this.Where(filter).length; | ||
} else { | ||
return that.length; | ||
return this.length; | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
Array.prototype.Distinct = function<T> (this: T[], valueSelector?: ((item: T) => any) | string): T[] { | ||
Linq4JS.Helper.NonEnumerable("Distinct", function<T> (this: T[], valueSelector?: ((item: T) => any) | string): T[] { | ||
let that: T[] = this; | ||
|
||
if (valueSelector != null) { | ||
let valueSelectorFunction = Linq4JS.Helper.ConvertFunction<(item: T) => any>(valueSelector); | ||
|
||
return that.Where((x, i) => { | ||
return this.Where((x, i) => { | ||
return that.FindIndex(y => valueSelectorFunction(y) === valueSelectorFunction(x)) === i; | ||
}); | ||
} else { | ||
return that.Where((x, i) => { | ||
return this.Where((x, i) => { | ||
return that.FindIndex(y => y === x) === i; | ||
}); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.