-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/array-and-nullable-type-declarations
- Loading branch information
Showing
73 changed files
with
2,790 additions
and
777 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
292 changes: 225 additions & 67 deletions
292
src/DotVVM.Framework.Tests/Binding/JavascriptCompilationTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
src/DotVVM.Framework/Binding/HelperNamespace/ListExtensions.cs
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DotVVM.Framework.Binding.HelperNamespace | ||
{ | ||
public static class ListExtensions | ||
{ | ||
public static void AddOrUpdate<T>(this List<T> list, T element, Func<T,bool> matcher, Func<T,T> updater) | ||
{ | ||
var found = false; | ||
for (var index = 0; index < list.Count; index++) | ||
{ | ||
if (!matcher(list[index])) | ||
continue; | ||
|
||
found = true; | ||
list[index] = updater(list[index]); | ||
} | ||
|
||
if (!found) | ||
list.Add(element); | ||
} | ||
|
||
public static void RemoveFirst<T>(this List<T> list, Func<T,bool> predicate) | ||
{ | ||
for (var index = 0; index < list.Count; index++) | ||
{ | ||
if (predicate(list[index])) | ||
{ | ||
list.RemoveAt(index); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
public static void RemoveLast<T>(this List<T> list, Func<T, bool> predicate) | ||
{ | ||
for (var index = list.Count - 1; index >= 0; index--) | ||
{ | ||
if (predicate(list[index])) | ||
{ | ||
list.RemoveAt(index); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
} |
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.