diff --git a/NiL.JS/Core/Interop/DictionaryWrapper.cs b/NiL.JS/Core/Interop/DictionaryWrapper.cs index a59db945c..747825acd 100644 --- a/NiL.JS/Core/Interop/DictionaryWrapper.cs +++ b/NiL.JS/Core/Interop/DictionaryWrapper.cs @@ -4,6 +4,12 @@ namespace NiL.JS.Core.Interop { + public static class DictionaryWrapper + { + public static DictionaryWrapper Of(IDictionary dictionary) + => new DictionaryWrapper(dictionary); + } + public sealed class DictionaryWrapper : JSObject { private readonly IDictionary _target; diff --git a/NiL.JS/Extensions/JSValueExtensions.cs b/NiL.JS/Extensions/JSValueExtensions.cs index d4b7f5778..8eddb08c7 100644 --- a/NiL.JS/Extensions/JSValueExtensions.cs +++ b/NiL.JS/Extensions/JSValueExtensions.cs @@ -176,8 +176,8 @@ public static T GetDefinedOr(this JSValue self, T defaultValue) if (self.Value is Function && typeof(Delegate).IsAssignableFrom(typeof(T))) return ((Function)self.Value).MakeDelegate(); - if (typeof(T).IsAssignableFrom(self.GetType())) - return (T)(object)self; + if (typeof(T).IsAssignableFrom(self.Value.GetType())) + return (T)self.Value; try {