Introduced `ConverterHelper` and `ExpandoObjectConverter` to handle conversions from .NET dynamic objects to JavaScript objects. Updated integration tests to validate the conversion and sorting functionalities. Fixes #5895
22 lines
534 B
C#
22 lines
534 B
C#
using System.Dynamic;
|
|
using Elsa.JavaScript.Helpers;
|
|
using Jint;
|
|
using Jint.Native;
|
|
using Jint.Runtime.Interop;
|
|
|
|
namespace Elsa.JavaScript.ObjectConverters;
|
|
|
|
internal class ExpandoObjectConverter : IObjectConverter
|
|
{
|
|
public bool TryConvert(Engine engine, object value, out JsValue result)
|
|
{
|
|
if (value is ExpandoObject expandoObject)
|
|
{
|
|
result = ConverterHelper.ConvertToJsObject(engine, expandoObject);
|
|
return true;
|
|
}
|
|
|
|
result = JsValue.Null;
|
|
return false;
|
|
}
|
|
} |