Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nilproject committed Jun 8, 2022
1 parent e4839b2 commit 4aa81ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NiL.JS/Core/Interop/DictionaryWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

namespace NiL.JS.Core.Interop
{
public static class DictionaryWrapper
{
public static DictionaryWrapper<TKey, TValue> Of<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
=> new DictionaryWrapper<TKey, TValue>(dictionary);
}

public sealed class DictionaryWrapper<TKey, TValue> : JSObject
{
private readonly IDictionary<TKey, TValue> _target;
Expand Down
4 changes: 2 additions & 2 deletions NiL.JS/Extensions/JSValueExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public static T GetDefinedOr<T>(this JSValue self, T defaultValue)
if (self.Value is Function && typeof(Delegate).IsAssignableFrom(typeof(T)))
return ((Function)self.Value).MakeDelegate<T>();

if (typeof(T).IsAssignableFrom(self.GetType()))
return (T)(object)self;
if (typeof(T).IsAssignableFrom(self.Value.GetType()))
return (T)self.Value;

try
{
Expand Down

0 comments on commit 4aa81ef

Please sign in to comment.